Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. // usage: cc -o char_array_longlong char_array_longlong.c
  2. // output: 0x706050403020100
  3. // 0xf0e0d0c0b0a0908
  4. #include <stdio.h>
  5. #include <stdint.h>
  6.  
  7. int main() {
  8. uint8_t array[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ,14, 15};
  9. for(int i=0; i<sizeof(array); i+=8) {
  10. uint8_t *p = array + i;
  11. uint64_t l = *((uint64_t *)p);
  12. printf("0x%llx\n", l);
  13. }
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement