Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!topaz!ll-xn!mit-amt!mit-eddie!genrad!decvax!decwrl!amdcad!amdimage!prls!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP Newsgroups: net.lang.c Subject: Re: Pointers and Arrays Message-ID: <477@mcgill-vision.UUCP> Date: Sat, 9-Aug-86 06:13:57 EDT Article-I.D.: mcgill-v.477 Posted: Sat Aug 9 06:13:57 1986 Date-Received: Tue, 12-Aug-86 15:09:25 EDT References: <2504@brl-smoke.ARPA> <475@dg_rtp.UUCP> Organization: McGill University, Montreal Lines: 33 [ > through >>>> re &array ] >> If you think about it, a pointer to an int can be used (and is) as a >> pointer to an array of ints. Unless you apply ++ to it, they are the >> same thing. (I can already feel the flames approaching). > I assume Jim really means "unless you apply ++, --, [], *, +, -, +=, or > -=" (unless I'm overlooking one). That is, unless you use it in > arithmetic, subscripting, or indirection. Sort of covers what you can > do with a pointer, doesn't it? You are overlooking something important. They are the same thing UNTIL the size of what the pointer points to becomes important. These situations are: ) ++ ) -- ) [] with a non-zero subscript ) + ) - ) += ) -= As for what they SHOULD be....a pointer to an array should be just that; indirecting off it should result in an array. There are good reasons this isn't done; I have yet to hear an implementation suggested that doesn't have worse flaws than the flaw currently under discussion. -- der Mouse USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse think!mosart!mcgill-vision!mouse Europe: mcvax!decvax!utcsri!mcgill-vision!mouse ARPAnet: utcsri!mcgill-vision!mouse@uw-beaver.arpa "Come with me a few minutes, mortal, and we shall talk." - Thanatos (Piers Anthony's Bearing an Hourglass)