argv[] terminated by a NULL pointer?

Chris Torek torek at elf.ee.lbl.gov
Mon Jun 24 10:57:42 AEST 1991


In article <12187 at hub.ucsb.edu> angst at cs.ucsb.edu
(Hopelessly in love w/Donna Reed) writes:
>I'm porting some code that assumes that the argv[] array is terminated
>by a NULL pointer....  am I right in my belief that argv[] is not
>*guaranteed* to be terminated by a NULL pointer?  

Under Version 6 Unix, argv[argc] is (char *)-1.  This violates the
following wording from X3.159-1989 (`ANSI C'):

    argv[argc] shall be a null pointer.  (2.1.1.2, p. 7)

Thus, the answer to your question is both `no' and `yes'.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.lang.c mailing list