Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: pointers to arrays Message-ID: <1052@auspex.UUCP> Date: 20 Feb 89 19:13:36 GMT References: <19784@uflorida.cis.ufl.EDU> <1042@auspex.UUCP> <19797@uflorida.cis.ufl.EDU> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 28 >AUUUGH! Yeesh. Stop screaming, and please get either a copy of the pANS or of K&R Second Edition, and read it, before discussing this issue any further. This stuff really will work reasonably, whether you believe it yet or not. >what happens if you say (*foo) = muck (where muck is int muck[13]) The compiler, if it's at all good, says "sorry, the left-hand side isn't a valid lvalue, try again". No, (d)pANS C doesn't support array assignment. >(Long discussion which assumes that, if you can get a pointer to an >array you *must* be able to assign to it as a whole, and thus concludes >that "pointer to array" is an invalid concept) No, just because you can get a pointer to an array (BTW, C has supported the notion of "pointer to array" for quite a while, it just made it inconvenient to construct certain values of that type until (d)pANS C allowed you to stick & in front of an array-valued expression) doesn't mean you can put an array on the LHS of an assignment; not all things you can apply the & operator to are lvalues. Again, *please* get a copy of, say, K&R Second Edition, and read it thoroughly before commenting any further. Unfortunately, you'll have to read the "C Reference Manual" appendix for this stuff; there doesn't seem to be much in the way of tutorial information on the notion of a pointer to an array.