C'mon, guys!

Gilbert Cockton gilbert at aimmi.UUCP
Wed Jun 11 03:41:21 AEST 1986


In article <3904 at sun.uucp> guy at sun.UUCP writes:
>
>There's been a discussion in net.lang.c of features to be added to C;
>sometimes I think pointers should be *subtracted* from C, since people seem
>to get very confused about them.  
>
>OK, maybe they're useful, and shouldn't be removed.  C classes should spend
>*lots* more time on them than they are doing, though, given these problems;
>better that people learn in class before they start writing code, than be
>forced to ask several thousand people on USENET why their code doesn't work.

Despite reading three years of discussion on and off on the pointer-array
equivalance topic, as a casual user of C, I've never been able to come
up with a clear view on when pointers and arrays are equivalent.
I'm sure much of my confusion has actually been caused by reading the
news.

During some debates, large indigestible tracts have appeared. I
haven't got the time to wade through these and synthesise an idiot's
guide to array-pointer equivalences.

Any volunteers for a simple set of statements that get the message
across? There must be many C compiler experts out there.

All I can start with is a straw man, as I'm no expert. 

* given an array of dimensions a x b x c .. x n,
  the array name is a pointer to array[0][0][0]..[0]

* the only time this is any real use if when passing arrays by reference
  as `array' is easier and safer to write than

	  &(array[0][0][0]..[0])

  as you don't need to bear the array dimensions in mind.



More information about the Comp.lang.c mailing list