0

I'm testing sizeof macro in C/C++.

My main code is as follows

 void ShowSize(int RA[]);

 main()
 {
     int MyRA[10] = {1,2,3,4,5,6,7,8,9,0};

     printf("size of MyRA is %d\n", sizeof(MyRA) );

     ShowSize(MyRA);
 }

 void ShowSize(int RA[])
 {
     printf("Size in here is different %d\n", sizeof(RA));
 }

I would have thought the size is the same in both cases but it is not...

How can I make both printf statements show the same value? I've tried dereferencing the value inside the function since it's a pointer, right, but my values are not consistent.

fifamaniac04
  • 2,343
  • 12
  • 49
  • 72

0 Answers0