int main(int argc, char **argv)
||
int main(int argc, char *argv[])
Are ANSI / ISO C. They are equivlant expressions. Kerrigan reomments the later in his book ... I use the former believing it to more clearly denote the data type as a pointer to a pointer.
void main(void)
||
void main()
Are premissable C++ entry points. That is why say, gcc may give you an error while Visual Studio will not. g++, or gcc with appropriate command line arguements will compile the C++ constructs.
It is important to note that while
void main()
&&
void main(void)
are equivlant constructs in C++ they are not so in C. This is because C++ has stronger type checking and interperts the empty parenthasis as meaning (void) while C interperts them as meaning unspecified argument list.
In C++ the argument does matter ... void main(char ch) would not be linked as the entry point by default. The C++ compiler would mangle the name into something else...
int main(int argc, char **argv)
void main(int argc, char **argv)
int main()
int main(void)
void main(void)
int main(void)
are valid C++ constructs. Some operating systems specify more -- UNIX for example also has a main that takes a pointer to a list of environment variables after **argv, for example.
Regards,
Meredith Shaebanyan
|