1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| int a = 100; int *b = &a; printf("值1:%d, %d\n", a, *b);
*b = 200;
printf("值2:%d, %d\n", a, *b); printf("内存地址:%#x, %#x\n", a, *b);
b++; printf("值3:%d, %d\n", a, *b); printf("内存地址:%#x, %#x\n", a, *b);
int arr[] = {66, 15, 100, 888, 252}; printf("%d\n", sizeof(arr)); printf("%d\n", sizeof(int));
int len = sizeof(arr) / sizeof(int); printf("数组长度:%d\n", len);
printf("值:%d\n", *(arr + 1)); printf("值:%d\n", arr[1]);
int *p = arr; printf("指针:%d\n", *(p + 1)); printf("指针:%d\n", *p + 1); printf("指针:%d\n", *p++); printf("指针:%d\n", *p); printf("指针:%d\n", *++p); printf("指针:%d\n", ++*p); printf("指针:%d\n", *p);
|