Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ames!sun-barr!apple!rutgers!att!chinet!john From: john@chinet.chi.il.us (John Mundt) Newsgroups: comp.lang.c Subject: Re: main() - argc,argv Message-ID: <1989Nov30.204932.15705@chinet.chi.il.us> Date: 30 Nov 89 20:49:32 GMT References: <1093@nsscb.UUCP> Reply-To: john@admctr.chi.il.us (John Mundt) Organization: Chinet - Chicago Public Access UNIX Lines: 28 In article <1093@nsscb.UUCP> nrg@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@admctr.chi.il.us *OR* fred@teacha.chi.il.us (312) 998-5007 (Day voice) || -432-8860 (Answer Mach) && -432-5386 Modem