What is tha difference between "return 0" and "return 2(any other number)"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is tha difference between "return 0" and "return 2(any other number)"?

Please describe..

12th Apr 2018, 4:59 PM
Priyo
Priyo - avatar
3 Answers
+ 3
Hi Priyo, it's new type of statement, called a return statement. When an executable program finishes running, the main() function sends a value back to the operating system that indicates whether it was run successfully or not. This particular return statement returns the value of 0 to the operating system, which means “everything went okay!”. Non-zero numbers are typically used to indicate that something went wrong, and the program had to abort. 
12th Apr 2018, 5:13 PM
Uttam
Uttam - avatar
+ 3
Thank you @Uttam..
12th Apr 2018, 5:33 PM
Priyo
Priyo - avatar