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

Depends on your definition of 'needed' --- if you don't return 0 from main, your program will exit with an undefined status code, which means that if you use it from a shell script or makefile weird things might happen because your program may be considered to have failed.



No, if you don't return anything from main, return 0 is added for you by the compiler, at least in C++ and recent versions of C.




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

Search: