+ 2
why we return value 0 Not other value like 1,2etc.
please answer
4 Réponses
+ 6
Technically, in C or C++ main function has to return a value because it is declared as "int main"
which means "main function should return integer data type"
if main is declared like "void main", then there's no need of return 0.
Some compilers even accept and compile the code even if u dont write return 0. varies from compiler to compiler
if you write void main (), then we don't return anything. and if it's int main () , then you can return any value like 1,2,0 etc.
+ 2
You can use other values.
+ 1
why we can't leave it empty returned only
+ 1
return statement can be empty
I.e. return;
if return type of the function is void in nature