int myArray[10];
it is said that array names are address information.
what i want to ask is
does myArray mean exactly the same thing with &myArray [0]
if so, why sizeof(myArray ) is not equal to sizeof(&myArray [0]).
1 -what is the relation and difference between myArray and &myArray [0]
2- what is the relation and difference between (*myArray ) and myArray [0]
thanks in advance...
In C (and C++) the name of the array boils down to the address of the first
element of that array. The sizeof() operator is a bit funny, i.e. it is evaluated
at compile time: when you do 'sizeof(array)' the compiler knows what you're
talking about, i.e. the size in bytes taken by the entire array. OTOH when you
do this: 'sizeof(&array[0])' all the compiler knows is that you've taken the
address of the first element of that array, which is a simple pointer. So the
result of both sizeof() examples will most likely be different: the size of your
array measured in bytes versus the size of a simple pointer.
kind regards,
Jos