.TH envp "" "" "C Language"
.PC "Argument passed to main()"
\fBchar *envp[];\fR
.PP
.B envp
is an abbreviation for environmental parameter.
It is the traditional name for a pointer to an array of
string pointers passed to a C program's
.B main
function, and is by convention the third argument passed to
.BR main .
.SH Example
The following example demonstrates
.BR envp ,
.BR argc ,
and
.BR argv .
.DM
.ta 0.4i 2.5i
#include <stdio.h>
.sp \n(pDu
main(argc, argv, envp)
int argc;		/* Number of args */
char *argv[];		/* Argument ptr array */
char *envp[];		/* Environment ptr array */
{
	int a;
.DE
.DM
	printf("The command name (argv[0]) is %s\en", argv[0]);
	printf("There are %d arguments:\en", argc-1);
	for (a=1; a<argc; a++)
		printf("\etargument %2d:\et%s\en", a, argv[a]);
.DE
.DM
	printf("The environment is as follows:\en");
	a = 0;
	while (envp[a] != NULL)
		printf("\et%s\en", envp[a++]);
}
.DE
.SH "See Also"
.Xr "argc," argc
.Xr "argv," argv
.Xr "C language," c_languag
.Xr "environ," environ
.Xr "main()" main
