home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!ferkel.ucsb.edu!piggy!chupchup
- From: chupchup@ferkel.ucsb.edu (Robert Earl)
- Subject: Re: main()
- Message-ID: <chupchup.715509038@piggy>
- Organization: (EVIL!)
- References: <715416182@Isis.MsState.Edu> <6700001@tisdec.tis.tandy.com>
- Date: Thu, 3 Sep 1992 08:30:38 GMT
- Lines: 27
-
- doug@tisdec.tis.tandy.com writes:
-
-
- | Actually main() is defined as
- | int main(int argc, char **argv, char *envp);
-
- (I'm assuming "char *envp" was a typo of "char **envp"). Not in ANSI
- it isn't. There's no such thing as "envp". If your system refuses to
- translate a program without the envp declaration, it's not
- ANSI-conforming.
-
- | Argc is the number of arguments on the command line, with the program
- | name counting as one, argv is a pointer to an array of pointers to the
- | arguments (program name is argv[0]), and envp is a pointer to array of
- | pointers to the program's environment variables. This last is very
- | rarely used so you will usually see it prototyped with only 2 parameters.
-
- It's very rarely used in UNIX, particularly, because the startup
- routine stuffs envp in a global variable called "environ", probably so
- main() doesn't have to do it all the time. But "environ" doesn't
- exist in ANSI only getenv() and putenv(), and this is comp.lang.c. :-)
-
- --
- "If you've got a pig that likes jumping fences, | robert earl
- you have to make its fence a lot higher all at | rearl@ucsd.edu
- once -- if you do it by increments, all you're | rearl@piggy.ucsb.edu
- doing is training a jumping pig." -Henry Spencer|
-