+ 1
The output is 55, but I don't understand why the memory address of the *ptr is 23fe3c.
#include <stdio.h> int main() { int a[5] = {22, 33, 44, 55, 66}; int *ptr = NULL; ptr = a; /* point to the first array element */ ptr += 3; printf("%d %x\n", *ptr, ptr); /* 55 */ } /*The output is 55, but I don't understand why the memory address of the *ptr is 23fe3c. Here's the output for different values of an increment: (no increment) is 23fe30 (22) ptr++ is 23fe34 (33) ptr += 2 is 23fe38 (44) ptr += 3 is 23fe3c (55) <--Where I confuse. Why "c"? ptr += 4 is 23fe40 (66) */
5 ответов
+ 1
How about 23fe40. How can it go from 23fe3c to that number.
+ 1
How...