What is tha difference between "return 0" and "return 2(any other number)"? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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