C++ sizeof

1. sizeof(char) =   1                         

2. sizeof 'a'   =   1                        

3. sizeof "a"   =    2                   

4. strlen("a") =      2

 

short (*ptr[100])[200];

1. sizeof(ptr)           = 100*sizeof(short *)=400

2. sizeof(ptr[0])        = sizeof(shor *)=4

3. sizeof(*ptr[0])       = 200*sizeof(short)=400

4. sizeof((*ptr[0])[0])) =  sizeof(shor)=2

posted on 2008-04-21 15:45  清水无鱼  阅读(174)  评论(0)    收藏  举报

导航