Why isn't argv[argc]==(char *)0 ?
Ken Lee
klee at chico.pa.dec.com
Thu Nov 16 10:00:22 AEST 1989
In article <547.nlhp3 at oracle.nl>, bengsig at oracle.nl (Bjorn Engsig) writes:
=> The execv family of system calls all have char *argv[] as their second
=> parameter, and you are required to put an endmarker as (char *)0 in it.
=> On the other hand, main has int argc and char *argv[] but here, the
=> endmarker has disappeared.
Most (all?) UNIXes have argv[argc]==0, though many, especially System V
based ones, don't document it. Note that p.115 of the new K&R says
"the [ANSI C] standard requires that argv[argc] be a null pointer".
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee at decwrl.dec.com
uucp: uunet!decwrl!klee
More information about the Comp.unix.wizards
mailing list