Array question

Jim Spencer Jim.Spencer at p510.f22.n282.z1.mmug.edgar.mn.org
Fri Feb 15 09:57:44 AEST 1991


Robert Nelson Gasch writes in a message to All

RNG>  int *this_ptr;  this_ptr [0] = 1;  this_ptr [1] = 2;  . . . 
RNG> this_ptr [9] = 10; 
RNG> This works fine, but I really don't know why?? It seems you're 
RNG> using memory to store an array which was never really allocated. 
RNG> If anybody could briefly explain what exactly happens when you 
RNG> do this, I'd be greatly abliged as at this point I'm mystified. 

You are overwriting some memory that probably belongs to something else.  It is syntatically correct but you are going to get a big crash eventually.
 

--  
Jim Spencer - via The Minnesota Macintosh Users Group UUCP-Fido Gateway
UUCP: ...uunet!tcnet!kksys!edgar!mmug!22.510!Jim.Spencer
INET: Jim.Spencer at p510.f22.n282.z1.mmug.edgar.mn.org



More information about the Comp.lang.c mailing list