Why do we put a return zero command at the end in c++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why do we put a return zero command at the end in c++?

Is there any reason of just to make code more readable??

20th Jan 2020, 3:06 PM
Naval Surange
5 Answers
+ 3
By standards return type of main is treated as exit code of the program. If you return 0 at the end then it is treated as normal exit without any errors and Saboor Hakimi 🇦🇫 if you don't specify any return type then it is by default treated as 0
20th Jan 2020, 4:00 PM
Arsenic
Arsenic - avatar
0
Let me show you a trick about how to run a C++ programme without returning 0 at the end, but don't ask how!
20th Jan 2020, 3:50 PM
Abdol Hashimi
Abdol Hashimi - avatar
0
Run this code #include <iostream> using namespace std; #undef int int main() { cout << "Hello, World!"; }
20th Jan 2020, 3:54 PM
Abdol Hashimi
Abdol Hashimi - avatar
0
Thanks for sharing...🤓
21st Jan 2020, 4:17 AM
Naval Surange