What is the usage of return 0 in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the usage of return 0 in c++

#include <iostream> using namespace std; int main() { return 0; } please up like and comment

22nd Dec 2016, 5:39 PM
Salih Ac
Salih Ac - avatar
3 Answers
+ 7
returns 0?
22nd Dec 2016, 5:41 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 4
Could indicate 'successful execution' of a function - in main() it often indicates: 'programmer didn't bother to use return codes | compiler defaulted to 0 due to null return | success'. For truth values, often 0==False.
22nd Dec 2016, 5:52 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
It indicates the end of the program to the compiler.
2nd Jan 2017, 12:59 AM
Malvern Panashe Mhepo
Malvern Panashe Mhepo - avatar