0

Not main?

I realized that the type return is int but why are we returning a string? And why return 0? I ran the Code with return 0; and there were no errors what's the purpose of 0?

19th May 2018, 6:02 PM
parth patel
1 Answer
+ 4
In C and C++ programs the main function is of type int and therefore it should return an integer value. The return 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". https://www.codeproject.com/Questions/693038/why-do-we-have-to-use-return
19th May 2018, 6:07 PM
Scooby
Scooby - avatar