[comp.lang.c] Exit from main

trt@rti.UUCP (Thomas Truscott) (08/18/88)

In article <184@sabin.UUCP>, bjm@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