+ 1
about return
what does return 0 mean in main program?
2 Answers
0
In my college, they explain it to beginners like this.
The return 0 is written at the end of a program as c++ follows top down approach, ie, the statements at top are executed first and then it the control goes down and so on. If there is no compilation error, it would reach the return 0 statement and the code when run, would display " process returned 0 " at the end, meaning there was no error in running the codes above it, ie, no compilation error. The other obvious reason is that int main needs to have a return type of integer type.