What goes on stack?

Knudsen knudsen at ihlpl.ATT.COM
Tue Oct 25 05:15:46 AEST 1988


[Email failed, so this is posted]
All those "dynamic" arrays (known as "automatic" in C-ese
and "local" in CS courses) are also allocated on the stack.
That's what allows their storage to be freed up when their
function returns.

However, what will probably help in your case is to put *more*
of your data into automatics, not less.  You seem to be short
on global data space.  Be sure to declare
global or static only what really needs to be.
Of course any automatic variables in main() will persist
on the stack thruout the whole execution anyway, so no harm
if they're global.
-- 
Mike Knudsen  Bell Labs(AT&T)   att!ihlpl!knudsen
"Lawyers are like handguns and nuclear bombs.  Nobody likes them,
but the other guy's got one, so I better get one too."



More information about the Comp.lang.c mailing list