2012-07-15 38 views
-6

计划,以了解sizeof操作符:这段代码的输出是怎样的?

#include<stdio.h> 
#include<conio.h> 
#include<string.h> 
main() 
{ 
    char *mess[]={       //array of pointers 
    "amol is a good boy", 
    "robin singh", 
    "genious boy", 
    "bitch please" 
    }; 
    printf("%d",sizeof(mess)); // what does sizeof operator do? 
} 

请解释一下这段代码的输出。

+2

什么是输出?什么*部分*你不明白吗?您的问题越具体,我们就可以提供更好的帮助。 – Levon 2012-07-15 12:42:29

+0

也告诉printf(“%d”,sizeof(mess [2])); – amol 2012-07-15 12:42:30

+0

我无法理解,第4弦的o/p – amol 2012-07-15 12:43:34

回答

2

这是以char 4个指针的存储大小(以字节为单位)。

1

你有你的答案正确的问题。它有一个指针数组的大小。

所以尺寸是4 * size of a pointer。 (在我的系统上是32)。您的系统可能会有所不同。