轉自:https://blog.csdn.net/qq_39126966/article/details/82285868
char.c:
#include<stdio.h>
int main()
{
char c = 'a';
char *p = &c;
char a = 'abcd';
char *d[2];
printf("%d\n",sizeof(c));
printf("%d\n",sizeof(p));
printf("%d\n",sizeof(a));
printf("%d\n",sizeof(d));
return 0;
}
測試環境:
編譯運行:
總結:
在上述64位測試機中:
char:1字節
char *:8字節
char * 指針數組:8字節 × 數組長度
備註:
最好自行運行代碼測試