以下为linux下的32位C程序,请计算sizeof的值
| char str[] = “Hello” ; char *p = str ; int n = 10; 请计算 sizeof (str ) = 6
sizeof ( p ) = 4
sizeof ( n ) = 4 |
| void Func ( char str[100]) { 请计算 sizeof( str ) = 4 }
|
| void *p = malloc( 100 ); 请计算 sizeof ( p ) = 4
|
本文详细解析了在Linux环境下32位C程序中使用sizeof运算符的方法及计算结果。通过具体示例介绍了不同数据类型和指针变量在内存中所占空间的大小,包括字符数组、字符指针及整型变量。
以下为linux下的32位C程序,请计算sizeof的值
| char str[] = “Hello” ; char *p = str ; int n = 10; 请计算 sizeof (str ) = 6
sizeof ( p ) = 4
sizeof ( n ) = 4 |
| void Func ( char str[100]) { 请计算 sizeof( str ) = 4 }
|
| void *p = malloc( 100 ); 请计算 sizeof ( p ) = 4
|
2201

被折叠的 条评论
为什么被折叠?