I have the following C program (as simple as it gets):
#include <stdio.h>
main()
{
printf("Test");
}
But using the gcc compiler within Cygwin, I cannot get this program to work unless I make the following modifications:
#include <stdio.h>
int main()
{
printf("Test");
return 0;
}
Could anyone explain why? What is so special about the "int" and the "return 0;" ?
Thanks! Amit
return 0inmainis incorrect in C (as opposed to C++), leaving out the return type should make itintby default. Your first code compiles successfully (but with warnings) on MinGW GCC 4.5 in-ansi,-std=c90and-std=c99modes.return 0;inmain()IIRC - a standards-aware compiler is then required to make it behave as if there was areturn 0;. Not that it's important...