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

+2

Why we use return =0 in the end ?

Is there any specification? Is it mandatory?

c

4/27/2021 5:52:47 PM

517 Chandrika Gogi

3 Answers

New Answer

+6

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

+2

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

+2

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.