main() - argc,argv
John Mundt
john at chinet.chi.il.us
Fri Dec 1 07:49:32 AEST 1989
In article <1093 at nsscb.UUCP> nrg at nsscb.UUCP (G.Narotham Reddy) writes:
>
>I would like to know what happens if main() is passed more than two arguments?
>
It is passed three by convention. It gets an environmental pointer to
an array of characters representing the environment (like what you see
when typing "env" and is where getenv() gets its data. Thus, although
you don't often see it, you could correctly write main as
main(argc, argv, envp)
int argc;
char **argv, **envp;
{
}
Also by convention, an external array pointer is available, namely
extern char **environ;
which points to the same envp listed above.
--
---------------------
John Mundt Teachers' Aide, Inc. P.O. Box 1666 Highland Park, IL
john at admctr.chi.il.us *OR* fred at teacha.chi.il.us
(312) 998-5007 (Day voice) || -432-8860 (Answer Mach) && -432-5386 Modem
More information about the Comp.lang.c
mailing list