Koenig on pointers and arrays

Cliff Joslyn cjoslyn at bingvaxu.cc.binghamton.edu
Thu Jan 18 12:31:48 AEST 1990


Under the kind attention of Chris Torek and others, I dutifully
understand that arrays are not pointers and pointers are not arrays.  I
believe that I understand the true relation between array subscripting
and pointer arithmetic and arrays passed as arguments converted to
pointers, etc.

So I turn to Andrew Koenig's great book /C Traps and Pitfalls/ and read
on p.  27:

"Only two things can be done to an array: determine its size and obtain
a pointer to element 0 of the array.  *All* other array operations are
actually done with pointers, even if they are written with what look
like subscripts.  That is, every subscript operation is equivalent to a
pointer operation, so it is possible to define the behavior of
subscripts entirely in terms of the behavior of pointers".

I presume this is accurate, and that e.g.  passing an array as a
parameter or taking its address are considered array operations which
are actually done with pointers.  In other words, is the first sentence
above literally accurate?

Thanks.

-- 
O------------------------------------------------------------------------->
| Cliff Joslyn, Cybernetician at Large, cjoslyn at bingvaxu.cc.binghamton.edu
| Systems Science, SUNY Binghamton, Binghamton NY 13901, USA
V All the world is biscuit shaped. . .



More information about the Comp.lang.c mailing list