.TH argv "" "" "C Language"
.PC "Argument passed to main()"
.B "char *argv[];"
.PP
.B argv
is an abbreviation for \*(QLargument vector\*(QR.
It is the traditional name for a pointer to an array
of string pointers passed to a C program's
.B main
function; by convention, it is the second argument passed to
.BR main .
By convention,
.B argv[0]
always points to the name of the command itself.
.SH Example
This example demonstrates both
.B argc
and
.BR argv[] ,
to recreate the
command
.BR echo .
.DM
main(argc, argv)
int argc; char *argv[];
{
	int i;
.DE
.DM
	for (i = 1; i < argc; ) {
		printf("%s", argv[i]);
		if (++i < argc)
			putchar('\ ');
	}
.DE
.DM
	putchar('\en');
	exit(0);
}
.DE
.SH "See Also"
.Xr argc, argc
.Xr "C language," c_languag
.Xr envp, envp
.Xr main() main
.br
\*(AS, \(sc5.1.2.2.1
