prev up next   top/contents search

comp.lang.c FAQ list · Question 6.10

Q: I'm still mystified. Is a pointer a kind of array, or is an array a kind of pointer?


A: An array is not a pointer, nor vice versa. An array reference (that is, any mention of an array in a value context), turns into a pointer (see questions 6.2 and 6.3).

There are perhaps three ways to think about the situation:

  1. Pointers can simulate arrays (though that's not all; see question 4.1).
  2. There's hardly such a thing as an array (it is, after all, a ``second-class citizen''); the subscripting operator [] is in fact a pointer operator.
  3. At a higher level of abstraction, a pointer to a block of memory is effectively the same as an array (though this says nothing about other uses of pointers).

But, to reiterate, here are two ways not to think about it:

  1. 4. ``They're completely the same.'' (False; see question 6.2.)
  2. 5. ``Arrays are constant pointers.'' (False; see question 6.9.)

See also question 6.8.


prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North