Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!gatech!hubcap!ncrcae!ncrlnk!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: pointers to arrays Message-ID: <1042@auspex.UUCP> Date: 18 Feb 89 09:37:36 GMT References: <19784@uflorida.cis.ufl.EDU> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 23 >Pointers are usually used to modify things, and &E I believe would >be used to modify the address of the array since that's what E >is (the address of the array). You may believe that, but you're wrong; in the language described by the pANS, "E" is not the address of the array, "E" is the array itself. (This may be an oversimplification, but I think it gets the essential point.) In most contexts an array-valued expression is converted to an expression that points to the first element of the array, but "operand of 'sizeof'" and "operand of unary &" are contexts where it isn't converted. Pointers are usually used to modify things, and you can definitely modify an array by assigning to elements of that array: int (*foo)[13]; int bar[13]; foo = &bar; (*foo)[7] = 666; should work in an ANSI C program once ANSI C exists and programs can be written in it and compiled by ANSI C-conformant compilers.