How big is the argv[] array?

Richard A. O'Keefe ok at quintus.UUCP
Thu Oct 6 10:00:40 AEST 1988


In article <4206 at bsu-cs.UUCP> dhesi at bsu-cs.UUCP (Rahul Dhesi) writes:
>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...
>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.

The System V Interface Definition says (Vol 1, Page 71, 1st paragraph)
	"argv is terminated by a null pointer", and
	"envp is terminated by a null-pointer".
The 4.2BSD manual page says
	"the array of pointers is terminated by a null pointer".
The VAX-11 C manual (for VMS) says on page 24-5
	"The last element of [argv] is always the null pointer (0).", and
	"The last element in envp must be the null pointer (0)."
On IBM mainframes, SAS Lattice C (C-101, p 4.6) says that
	"argv[argc] is 0"
and the IBM C Compiler reference manual says on page 8.3 that
there is a null pointer after the arguments in argv[].  (It should be
noted that the SAS manual gives an example of calling C from Fortran
which violates this convention, but that example also violates the convention
that the elements of argv[] are pointers to strings.)

So, assuming that !argv[argc] is portable between System V, 4.2,
VMS, and IBM mainframes.

Which are the implementations of C where argv[] is present but argv[argc]
is not defined?



More information about the Comp.lang.c mailing list