1 #include <stdio.h>
2 typedef unsigned long ulong;
3 int main(void){
4 char *pc = NULL;
5 int *pi = NULL;
6 double *pd = NULL;
7 long double *pld = NULL;
8 printf(“%5lu%5lu\n%5lu%5lu\n%5lu%5lu\n”,
9 (ulong)(pc + 1), (ulong)(pi + 1),
10 (ulong)(pd + 1), (ulong)(pld + 1),
11 (ulong)(pc + 3), (ulong)(pld + 3));
12 return 0;
13 }
—
输出结果:
1 4
8 12
3 36
解决方案
80
原因是你指向的是NULL,转成ulong以后就是0了
例如你改成char *pc = “sdfd”;这样的就能看到地址了
例如你改成char *pc = “sdfd”;这样的就能看到地址了