Declaration within a loop.

Wm E Davidsen Jr davidsen at crdos1.crd.ge.COM
Thu Sep 28 01:22:20 AEST 1989


In article <30174 at news.Think.COM>, barmar at kulla (Barry Margolin) writes:

|  Yes, a new i variable is declared.  However, at the end of each time
|  through the loop it is "undeclared", so it can be deallocated.  Most C
|  implementations will actually use the same memory location (probably
|  on the stack) each time. 

  Most C compilers allocate space on the stack for this when the
procedure is entered. It therefore is not a practical thing to do to
save space. The most common use is to correct for having forgotten to
declare a variable at the start of a procedure.
-- 
bill davidsen	(davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon



More information about the Comp.lang.c mailing list