Exit from main
Thomas Truscott
trt at rti.UUCP
Thu Aug 18 07:27:01 AEST 1988
In article <184 at sabin.UUCP>, bjm at sabin.UUCP (Brendan J. McMahon) writes:
> Different topic. Is there any reason why you should have to call exit,
> at this point in a program besides buffer flushing, or returning a value?
If main() calls "setbuf" with a local array as the buffer,
then if main simply returns the local array is no longer valid,
yet buffer flushing has not yet occurred.
Calling exit, or making the array static, or using "malloc(BUFSIZ)"
as the argument to setbuf, avoids the problem.
So, did your program call setbuf?
Tom Truscott
More information about the Comp.lang.c
mailing list