读书人

char *a[三][4] 占多大内存空间

发布时间: 2012-09-08 10:48:07 作者: rapoo

char **a[3][4] 占多大内存空间
char **a[3][4] 占多大内存空间

[解决办法]

探讨

In the programming languages C and C++, the unary operator sizeof is used to calculate the size of any datatype, measured in the number of bytes required to represent the type.
C/C++ code

#includ……

[解决办法]
我觉该定义应该这样理解是:char **a[3][4];//a是一个维数组,数组由3×4=12个元素组成;而每个元素的类型是char ** 类型(一个2级指针);不管是几级指针其大小都是4字节!所以sizeof(a)=4*(3*4)=48!(以上说明均是在32位机下考虑的)!

读书人网 >C++

热点推荐