0
When do we use return 1
4 Answers
+ 2
You can technically return whatever integer you want in the main function, however, if I recall correctly, some compilers denote '0' as a successful execution.
0
when you need "NOT"
0
if you created a function of integer type then you can return any value but "it should be in integer type "
so if you want to
return 5
then you do so,
->because function "int main() " or any "int abc()"
tells you to return a integer not tells you to return 0
only.
example :-int main(){
int a=1,b=4;
return a+b;
}
here you not have to return 0
because function already return an integer value, which is a+b
0
When your programs exits with an error.