Clarification needed on Pointers/Arrays

Ray Butterworth rbutterworth at watmath.waterloo.edu
Sun Feb 26 00:59:09 AEST 1989


> sabbagh at acf3.NYU.EDU (sabbagh)
>>>So what are arrays?  They are POINTER CONSTANTS.
> If you are trying to 
> USE C, then it's the perfect way to understand them.
 
For those that STILL don't understand, consider this:

int   A[10];
float F;
short S;

What is A when evaluated in an expression?  a constant pointer to an int.
What is F when evaluated in an expression?  a double.
What is S when evaluated in an expression?  an int.

(see K&R, K&R2, pANSI, any C manual or tutorial for verification of this)

So, if you really want to think of A itself as a pointer constant,
then you'd better think of S itself as an int and F itself as a float.
If so, you must really enjoy being confused.

As for the rest of us:

What is A?  an array of 10 ints.
What is S?  a short int.
What is F?  a float.

(see K&R, K&R2, pANSI, any C manual or tutorial for verification of this)



More information about the Comp.lang.c mailing list