-
Need explanations...
Could you please explain why sometimes in the example the code is in this form
Code:
void main()
{
printf( "Welcome to C Programming.\n" );
}
sometimes
Code:
void main(void)
{
printf( "Welcome to C Programming.\n" );
}
sometimes
Code:
int main()
{
printf( "Welcome to C Programming.\n" );
}
and
Code:
main()
{
printf( "Welcome to C Programming.\n" );
}
-
Because example code isn't perfect.
Whenever you see any of the other three example types, convert it to the third form. Even safer would be to convert it to:
Code:
int main(void)
{
/* ... */
return 0;
}
-
The main should always return an integer, this is what the C/C++ standard says. void main is not correct in this sense.