0
Why we use int main() in C++
In C ++ we start with int main() function qhy not we use only main() what is the difference
4 ответов
+ 3
According to C/C++ , syntax of defining a function is :-
Return type_function name (arguments)
And main() is no other exception.
It is necessary to specify it's return type
In C89, the unspecified return type defaults to int. So, main was equivalent to int main in C89. But in C99, this is not allowed and thus one must use int main.
+ 3
They are different standards of C language.
The first C standard was released 1989 nationally in USA, by their national standard institute ANSI. This release is called C89 or ANSI-C. From 1989-1990 this was "the C language".
In 1999, the C standard went through a major revision (ISO 9899:1999). This version of the standard is called C99. From 1999-2011, this was "the C language"
Source : https://en.wikipedia.org/wiki/C_(programming_language)
+ 1
What is c89 and c99
+ 1
Thanx great information