Path: utzoo!mnetor!tmsoft!torsqnt!hybrid!scifi!bywater!uunet!bria!mike Newsgroups: comp.lang.c Subject: Re: Array question Message-ID: <428@bria> Date: 10 Feb 91 20:53:53 GMT References: Reply-To: uunet!bria!mike Organization: MGI Group International, Los Angeles, CA Lines: 24 In an article, andrew.cmu.edu!rg2c+ (Robert Nelson Gasch) writes: >What happens if I do the following? Basically I don't really understand >*why* this works: > > int *this_ptr; > this_ptr [0] = 1; > this_ptr [1] = 2; > . . . > this_ptr [9] = 10; You are writing to some random memory location, and the reaction varies dependant on the operating system and/or hardware. One thing to point out is that pointers and arrays are _not_ interchangable entities _except_ when you are passing them to functions. The moral is this: when you mean to use a pointer, use a pointer; when you mean to use an array, use an array. -- Michael Stefanik | Opinions stated are not even my own. Systems Engineer, Briareus Corporation | UUCP: ...!uunet!bria!mike ------------------------------------------------------------------------------- technoignorami (tek'no-ig'no-ram`i) a group of individuals that are constantly found to be saying things like "Well, it works on my DOS machine ..."