这些大小对于变量数组和变量指针数组是否正确?

R4D*_*4D4 1 c++ arrays size pointers

下面代码中的注释中陈述的整个数组的大小和语句是否正确?

//gArray uses sizeof(char)*100 = 1*100 = 100 bytes.
char gArray[100];

//gArray uses sizeof(char)*100*50 = 1*100*50 = 5000 bytes.
char gArray[100][50];

//gArray is a 2D array, each element is a pointer to a char (although
//char data type is irrelevant).
//gArray uses sizeof(void*)*100*50 = (4 or 8) * 100 * 50 = 20000 or 40000 bytes.
char* gArray[100][50];
Run Code Online (Sandbox Code Playgroud)

谢谢.

Mar*_*k B 6

sizeof(char)根据定义1,它将是100,5000和20000或40000(在大多数系统上 - 标准不禁止128位以上的指针).