<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>I know it matters when exit() is called from any method other than main(). But I noticed that in the text book they always use exit() even in the main() function. That's why I was curious. I guess its more like common practice then.&nbsp;</div><div><br></div><div>Thanks,</div><div>Sadia&nbsp;</div><br><div><div>On Sep 10, 2014, at 3:50 PM, JIANLONG ZHOU &lt;<a href="mailto:jzhou14@stevens.edu">jzhou14@stevens.edu</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">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:&nbsp;<div><a href="http://stackoverflow.com/questions/17383015/difference-between-return-0-and-exit-0">http://stackoverflow.com/questions/17383015/difference-between-return-0-and-exit-0</a></div><div><br></div><div>Thanks,</div><div>JIANLONG ZHOU<br><div><div>On Sep 10, 2014, at 3:32 PM, Sadia Akhter &lt;<a href="mailto:sakhter@stevens.edu">sakhter@stevens.edu</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<br><br>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?<br><br>Thanks,<br>Sadia Akhter<br>_______________________________________________<br>cs631apue mailing list<br><a href="mailto:cs631apue@lists.stevens.edu">cs631apue@lists.stevens.edu</a><br><a href="https://lists.stevens.edu/mailman/listinfo/cs631apue">https://lists.stevens.edu/mailman/listinfo/cs631apue</a><br></blockquote></div><br></div></div></blockquote></div><br></body></html>