Hacker News new | past | comments | ask | show | jobs | submit login

I was curious why you would return a value and not just make the main function return void (in the interests of simplicity and maintainability, and assuming you're using C not C++). So I wrote my own such program, and discovered that void main(void) returns 3 to the OS. Any ideas why?



Because returning void means that, on most platform, return whatever is left in %eax at the time of function termination.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: