+ 2

Why we use return =0 in the end ?

Is there any specification? Is it mandatory?

27th Apr 2021, 5:52 PM
517 Chandrika Gogi
517 Chandrika Gogi - avatar
3 odpowiedzi
+ 6
This is status code which means that the code executed successfully.
27th Apr 2021, 6:04 PM
minirkk
minirkk - avatar
+ 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
27th Apr 2021, 6:05 PM
Mihail
Mihail - avatar
+ 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.
28th Apr 2021, 1:38 AM
Sonam Tsering Gurung
Sonam Tsering Gurung - avatar