char 指针占用空间
写出运行结果: {// test1 char str[] = "world"; cout << sizeof(str) << ": "; char *p = str; cout << sizeof(p) << ": "; char i = 10; cout << sizeof(i) << ": "; void *pp = malloc(10); cout << sizeof(p) << endl; } 6:4:1:4
讲2点(在vc++9.0中)
1.所有的指针类型都是占4个字节
2.数组的size是由数组本身大小所决定的,比如a[10],sizeof(a) = 10;