指针长度由什么决定呢?
我电脑的CPU是 Intel® Celeron® Processor E3300 但是测试了下,发现指针的长度还是4个字节,为什么不是8个字节呢?
#include<stdio.h> int main() { char ch='a'; int x=0; long y=0; float z=0; char *p=&ch; int *p2=&x; long *p3=&y; float *p4=&z; printf("The size of ch=%d p=%d\n",sizeof(*p),sizeof(p)); printf("The size of x=%d p=%d\n",sizeof(*p2),sizeof(p2)); printf("The size of y=%d p=%d\n",sizeof(*p3),sizeof(p3)); printf("The size of z=%d p=%d\n",sizeof(*p4),sizeof(p4)); system("pause"); return 0; }结果: