C ++ Standard: ( Source )
The C ++ 98 standard reads in section 3.6.1.2
It must have a return type of int, but otherwise its implementation type. All implementations must have the following main definitions: int main () and int main (int argc, char * ARGV [])
Usually there are 3 sets of parameters:
- no options /
void int argc, char ** argvint argc, char ** argv, char ** env
Where argc is the number of commands, argv is the actual command line, and env is the environment variable.
Window:
For a Windows application, you have a WinMain entry point with a different signature instead of the main one.
int WINAPI WinMain( __in HINSTANCE hInstance, __in HINSTANCE hPrevInstance, __in LPSTR lpCmdLine, __in int nCmdShow );
OS X: ( Source )
Mac OS X and Darwin have a fourth parameter containing arbitrary information provided by the OS, such as the path to the binary executable:
int main(int argc, char **argv, char **envp, char **apple)
Brian R. bondy
source share