about return | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

about return

what does return 0 mean in main program?

16th Sep 2017, 3:04 AM
anwesh jami
anwesh jami - avatar
2 Réponses
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.
16th Sep 2017, 3:30 AM
Siraz Naorem
Siraz Naorem - avatar