#include <stdio.h>
#include <stdlib.h>
int main() {
// 指针运算
int i = 1;
int *p = &i;
printf("Value of i: %d\n", i);
printf("Value of p: %p\n", (void*)p );
printf("Value of p + 1: %p\n", (void*)(p + 1) );
printf("Value of p - 1: %p\n", (void*)(p - 1) );
printf("Value of p + 2: %p\n", (void*)(p + 2) );
printf("Value at *(p + 1): %d\n", *(p + 1) ); // 注意这里解引用p+1
return 0;
}
/* Value of i: 1
Value of p: 000000000062FE14
Value of p + 1: 000000000062FE18
Value of p -1: 000000000062FE10
Value of p + 2: 000000000062FE1C
Value at *(p + 1): 6487572 */