What does sizeof(&array) return?

前端 未结 3 1852
予麋鹿
予麋鹿 2020-11-22 01:42

Following the question: How come an array's address is equal to its value in C?

#include 
#define N 10    
char str2[N]={\"Hello\"};
int m         


        
3条回答
  •  既然无缘
    2020-11-22 02:37

    str2 is of type char [10] (i.e, array 10 ofchar`)

    &str2 is of type char (*)[10] (i.e., pointer to an array 10 of char).

    So sizeof (&str2) yields the size of an objet of pointer type char (*)[10]

提交回复
热议问题