Sizeof arrays and pointers

后端 未结 5 560
小蘑菇
小蘑菇 2020-11-30 15:20

Here is my sample code

#include
void main()
{
 int arr[]={1,2,3,4,5,6};
 char *ptr,a;
 a=\'c\';
 ptr=&a;
 int *ptr1,a1;
 a1=4;
 ptr1=&         


        
5条回答
  •  醉梦人生
    2020-11-30 16:25

    From Wikipedia

    When sizeof is applied to the name of an array, the result is the size in bytes of the whole array. (This is one of the few exceptions to the rule that the name of an array is converted to a pointer to the first element of the array.)

提交回复
热议问题