Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!virtech!cpcahil From: cpcahil@virtech.UUCP (Conor P. Cahill) Newsgroups: comp.lang.c Subject: Re: Declaration within a loop. Message-ID: <1198@virtech.UUCP> Date: 27 Sep 89 15:52:12 GMT References: <2085@hydra.gatech.EDU> Distribution: usa Organization: Virtual Technologies Inc Lines: 17 In article <2085@hydra.gatech.EDU>, dvu@prism.gatech.EDU (Dinh Vu) writes: > Is it true that every time through the loop, a new i variable > is declared (more memory allocated ??)? Or the same i variable > is reused... I see something similiar to this in the GNU 'make' > source code. Also, if I run the code above long enough, will it > take all memory. Thanks. The variable i is an automatic variable allocated on the stack at the start of block. It is not re-allocated each time through the loop. This kind of thing can be verified by creating a small source code file and compiling it with the -S flag to get the assembly language. -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+