sizeof array clarification
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am studying for a final tomorrow in C, and have a question regarding the sizeof operator. Let's say the size of an int is 32 bits and a pointer is 64 bits. If there were a function: int foo (int zap[]) { int a = sizeof(zap); return a; } Because zap is a pointer, foo would return 8 , as that's how many bytes are needed to store this particular pointer. However, with the following code: int zip[] = { 0, 1, 2, 3, 4, 5 }; int i = sizeof(zip); i would be 6 * sizeof(int) = 6 * 4 = 24 Why is it that sizeof(zip) returns the number of elements