Why do we have to use 'return 0' statement in C? in the end of main function. I know This means all things are going on way. But what does it mean? What exactly are there at the background of this ?
Asked
Active
Viewed 280 times
-6
-
Why are you tagging languages unrelated to the question? – James Adkison Feb 15 '16 at 13:32
-
1Googling your exact title gives: 'About 327,000,000 results'. Is one of those any use? – Martin James Feb 15 '16 at 13:33
-
If you really want to know the answer, install Linux and start writing shell scripts. Write scripts that have conditionals (i.e. "If that program executed successfully, then execute this other one") You'll find out real quick how useful that "return 0" is. – Gillespie Feb 15 '16 at 16:57
2 Answers
2
It returns a number to the environment that started it... Every process begins with a set of arguments and returns an int
indicating success or failure
1
Potentially, a calling process can read the result and use it as information on what the execution of the program did.

Codor
- 17,447
- 9
- 29
- 56