+ 2

Why we use return 0 in C ???

â˜șâ˜șâ˜ș

27th Nov 2017, 6:04 AM
Aman Jain
Aman Jain - avatar
3 Answers
+ 15
In C and C++ programs the main function is of type int and therefore it should return an integer value. Thereturn value of the main function is considered the "Exit Status" of the application. On most operating systems returning 0 is a success status like saying "The program worked fine". Source - https://www.codeproject.com/Questions/693038/why-do-we-have-to-use-return
27th Nov 2017, 6:10 AM
qwerty
qwerty - avatar
+ 2
The main method is of int type and requires a returning integer value. Signifies a successful program execution.
27th Nov 2017, 6:09 AM
Marcus Germano
0
when we give int as return type for any function. return keyword must became compulsory to Prescribed​ at end of function.Now come to 0...it means the function return the intger value 0.
27th Nov 2017, 6:29 AM
Faisal Rahman
Faisal Rahman - avatar