Why do we use return 0; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Why do we use return 0;

22nd Oct 2016, 3:01 PM
Hritik
3 Answers
+ 2
Short answer: just put it and forget about it. Long answer: if you launch your program with another program, the host program can use the return value of your program to do things differently. A return value of 0 means no error, a non-zero value means any error of your choosing. That feature is seldom used, so don't mind that and just put return 0.
22nd Oct 2016, 3:19 PM
Zen
Zen - avatar
0
To add onto Zen's answer, most compilers will add it automatically if it's not there when the code is compiled.
22nd Oct 2016, 4:00 PM
DaemonErrors
DaemonErrors - avatar
- 1
So as to end the compilation of the programe
22nd Oct 2016, 4:16 PM
rahul sharma
rahul sharma - avatar