Argument Description

The argc parameter in the main function is an integer specifying how many arguments are passed to the program from the command line. Since the program name is considered an argument, the value of argc is at least one.

The argv parameter is an array of pointers to null-terminated strings representing the program arguments. Each element of the array points to a string representation of an argument passed to main. (See topic for information about arrays.) The argv parameter can be declared as an array of pointers to type char ( char *argv[] ) or as a pointer to pointers to type char ( char **argv ). The first string ( argv[0] ) is the program name. The last pointer ( argv[argc] ) is NULL. (See getenv in the Run-Time Library Reference manual for an alternative method for getting environment variable information.)

The envp parameter is a pointer to an array of null-terminated strings that represent the values set in the user's environment variables. The envp parameter can be declared as an array of pointers to char ( char *envp[] ) or as a pointer to pointers to char ( char **envp ). The end of the array is indicated by a NULL pointer.