Difficulty in understanding

Jul 22, 2012 at 9:44am
int a[4];

Declares an array of integers of size 4

a is a pointer to the base element of the array

So my question is, does a also occupies a memory as a pointer, different than the memory occupied by the array?
Jul 22, 2012 at 9:48am
a is a pointer to the base element of the array

No, a is an array of int with 4 elements, which you should answer your question.
However, an array can be implicitly converted into a pointer to its first element.
Jul 22, 2012 at 9:58am
What does this mean: an array can be implicitly converted into a pointer to its first element
Jul 22, 2012 at 10:01am
It means that you can do the following:

1
2
3
int a[4];
int* b=a;
int* e=a+4;
Jul 22, 2012 at 10:13am
Sameer Implicit Conversion means that the Compiler converts type to another automatically :) But this has rules :)
Topic archived. No new replies allowed.