edited by
303 views
0 votes
0 votes
#include<stdio.h>
typedef int ARRAY[10][10];
int main() {
   ARRAY arr[2];
   printf("Size is %d",sizeof(arr));
}


 

The program on running produces output Size is $800$

I know typedef is used for providing alternate names to existing datatypes. Can someone explain what's happening? Or correct me

edited by

1 Answer

0 votes
0 votes
typedef int ARRAY[10][10]

and ARRAY arr[2]

so  ARRAY replaced with arr[2] and becomes

int arr[2][10][10]

so sizeof(arr)=2*10*10*sizeof(int)=800

Related questions