How big is the argv[] array?

Rahul Dhesi dhesi at bsu-cs.UUCP
Thu Oct 6 02:26:43 AEST 1988


In article <8631 at smoke.ARPA> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>argv[argc] is supposed to be a null pointer...
>Some older systems did
>not have a null pointer in argv[argc], however.  I don't think
>you're likely to encounter any such systems today.

Since this is comp.lang.c and not a UNIX newsgroup, the following
footnote from "Advanced UNIX Programming" by Marc J. Rochkind (p 105)
is relevant:

     "The C Programming Language" does not state anywhere that argv[argc]
     is NULL.  Neither do most UNIX manuals.  So it's unwise to assume that
     argv is terminated with NULL, because in non-UNIX systems or in
     UNIX clones it may not be true.

(Does ANSI C make argv[argc] valid?  Even so, ANSI-conformant compilers
will not be universally available for some years.)  There are so many
different non-UNIX C implementations around that a defensive programmer
will avoid assuming too much that is not in K&R.
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi



More information about the Comp.lang.c mailing list