Why we use return =0 in the end ? | Sololearn: Learn to code for FREE!


Why we use return =0 in the end ?

Is there any specification? Is it mandatory?


4/27/2021 5:52:47 PM

517 Chandrika Gogi

3 Answers

New Answer


This is status code which means that the code executed successfully.


the return statement is used to terminate a function. The main function should return value 0, it means EXIT_SUCCESS, and otherwise returns -1, meaning EXIT_FAILIURE


It is not really mendatory If even if you dont put return 0, still code will execute sucesfully unless you dont make any error in the code.