码迷,mamicode.com
首页 > 其他好文 > 详细

Sizeof

时间:2015-04-15 21:32:17      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:c语言

#include <stdio.h>
#include <string.h>


void fun(int b[100])  
{  
    printf("sizeof(b) is %d\n",sizeof(b));  
}  
  
int main(void)   
{  
    int *p=NULL;  
    int a[100];  
    int b[100];  
    printf("sizeof(p) is %d\n",sizeof(p));  
    printf("sizeof(*p) is %d\n",sizeof(*p));  
    printf("sizeof(a[100]) is %d\n",sizeof(a[100])); 
    printf("sizeof(a[99]) is %d\n",sizeof(a[99])); 
    printf("sizeof(a) is %d\n",sizeof(a));  
    printf("sizeof(&a) is %d\n",sizeof(&a));
    printf("sizeof(b) is %d\n",sizeof(b));  
    printf("sizeof(&b) is %d\n",sizeof(&b));
    printf("sizeof(&a[0] is %d\n",sizeof(&a[0]));  
    printf("sizeof(&b[0] is %d\n",sizeof(&b[0]));  
    //  
    fun(b);  
    return 1;  

}  

-------------------------------------------------------------------输出结果

sizeof(p) is 4

sizeof(*p) is 4

sizeof(a[100]) is 4

sizeof(a[99]) is 4

sizeof(a) is 400

sizeof(&a) is 400

sizeof(b) is 400

sizeof(&b) is 400

sizeof(&a[0] is 4

sizeof(&b[0] is 4

sizeof(b) is 4

Press any key to continue

Sizeof

标签:c语言

原文地址:http://blog.csdn.net/huyue091714213/article/details/45064583

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!