Clarification needed on Pointers/Arrays

Wayne A. Throop throopw at xyzzy.UUCP
Sat Feb 25 07:46:55 AEST 1989


> sabbagh at acf3.NYU.EDU (sabbagh)
>>>So what are arrays?  They are POINTER CONSTANTS.
>>Urk.  While this is true in a sense, it's been my observation that people who
>>think of them that way are taking the wrong path to understanding.
> Hmm. It depends on what you are trying to understand.  If you are trying to 
> USE C, then it's the perfect way to understand them.

How then to account for their behavior with "sizeof"?  I recommend
thinking of them not AS pointer constants, but as (almost) universally
CONVERTED TO pointer constants.  That accounts for their behavior
in sizeof, and even in multiply-dimensioned arrays (that is, if you
have an array of arrays, you have an array of... constants??? nah!).

So again... it's not that arrays ARE pointer constants, but that they
are CONVERTED TO pointer constants (almost always).  This seems to me
to be the least confusing way of thinking about it while using C.

--
All things scabbed and ulcerous,
All pox both great and small,
Putrid, foul and gangrenous,
The Lord God made them all.
          --- Monty Python
-- 
Wayne Throop      <the-known-world>!mcnc!rti!xyzzy!throopw



More information about the Comp.lang.c mailing list