I've been learning C programming in a self-taught fashion for some weeks, and there are some questions that I have concerning the main()
function.
All functions must be declared in their function prototype, and later on, in their defintion. Why don't we have to declare the main()
function in a prototype first?
Why do we have to use int main()
instead of void main()
?
What does return 0 exactly do in the main()
function? What would happen if I wrote a program ending the main()
function with return 1;
, for example?
void main
, but this is a non-standard extension (it usually means "always return zero to the OS").