In reality, the main() function always returns an integer value therefore there is an int before the main () function
If the main() function return 0 means success likewise, if it is return(nonzero) means failure
Int main()
{
Statement 1;
Statement2;
Statement3;
Return 0;
}
There have been many textbooks written on C that state that you should always end the main() function with return 0;
With the older version of C if the compiler notices the main() function with int as the return type and doesn’t return a value causes a warning “control reaches end of non-void function”
But, according to the C99 version, it’s OK to end the main() function without returning a value
In short, the C99 standard states that the main() function will automatically return 0; without any error or warning from the compiler
Leave a Reply