int main( void )
int main( int argc, char *argv )
int main( int argc, char *argv, char *envp )
The third line above, where main accepts three parameters, is a Microsoft extension to the ANSI C standard. The third parameter, envp, is an array of pointers to environment variables. The envp array is terminated by a null pointer. [b]argc[/b]: An integer that contains the count of arguments that follow in argv. The argc parameter is always greater than or equal to 1. [b]argv[/b]: An array of null-terminated strings representing command-line arguments entered by the user of the program. By convention, argv is the command with which the program is invoked, argv is the first command-line argument, and so on, until argv[argc], which is always NULL. [b]envp [/b]: The envp array, which is a common extension in many UNIX systems, is used in Microsoft C++. It is an array of strings representing the variables set in the user's environment. This array is terminated by a NULL entry. It can be declared as an array of pointers to char (char *envp[ ]) or as a pointer to pointers to char (char **envp). If your program uses wmain instead of main, use the wchar_t data type instead of char. The environment block passed to main and wmain is a "frozen" copy of the current environment. If you subsequently change the environment via a call to putenv or _wputenv, the current environment (as returned by getenv/_wgetenv and the _environ/ _wenviron variable) will change, but the block pointed to by envp will not change.