[cs631apue] exit() vs return in c programs
jzhou14 at stevens.edu
Wed Sep 10 15:50:25 EDT 2014
Hi, I think there is no difference when you use exit(0) or return 0 in main(), but different when you try to use in sub function. Simply return will exit from current function, but exit will terminate the program, here is the link you can look at:
On Sep 10, 2014, at 3:32 PM, Sadia Akhter <sakhter at stevens.edu> wrote:
> In my previous experience with C, I have always used "return 0;" to return from main() function. Those were of course not any system programming codes. However, in the text book APUE, I noticed that they always use "exit(0)" in main(). Can anyone tell me why is that? Is there any significant difference between these two? Or is it just regular practice?
> Sadia Akhter
> cs631apue mailing list
> cs631apue at lists.stevens.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cs631apue