
arrays and pointers, char * vs. char [], distinction
I want to put it, that this is almost the *only* time what arrays
can be viewed as pointers:
"When the name of an array appear like an R-value, roughly an expression which
is not appearing immediately to the left of an assignment 'equal' sign,
then this name of an array can be treated by the programmer as a pointer
to the first element of an array." The sizeof operator takes an L-value
or a type, not an R-value.
So:
char c, text[5];
c = text[3] is c = *(text + 3)
But
char *p, q[5];
p = text is p = &(text[0])
But
q cannot be assigned = text
But
q[2] = text[2] is *(q + 2) = *(text + 2)
But
sizeof p is size of pointer but sizeof q is size of array
Daniel Chung (Mr.)