0
why is it necessary to write return 0 then }
5 Answers
+ 2
return o will terminate the program as soon as it is encountered with int main. return 0 used to return a value to the user , to avoid using it void main can be used as a replacement to int main
+ 1
At the time of declaring main is it necessary to return any value or not.lf we use void before main not necessary
+ 1
return is necessary because if we use some value to assign to a variable we have to return it back .but if we are not using any value then we write return 0
0
return 0 means the function closed normally or was successful and any other no (1-999) mean that an error occurred. Simple program will work for any of the value as they have to compile only those small sentences but think of a complex program as soon as compiler will read other value than 0 it will stop there and not execute further sentences as for them any no other than 0 means an error occurred.
and please avoid using VOID MAIN it's the wrong way to do.
0
only main() function reaturn a velues so you have to write reaturn, otherwise you use void main() function