argv[] terminated by a NULL pointer?

Lars Wirzenius wirzeniu at klaava.Helsinki.FI
Sun Jun 23 20:13:40 AEST 1991


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

The first edition of K&R doesn't say anything (as far as I can see)
about argv being terminated with NULL, so I think you're right. A quick
check with VMS C gives an access violation, cc and gcc on SunOS do have
a terminating NULL, however.

Also, the ANSI standard guarantees that argv[argc] == NULL.
-- 
Lars Wirzenius     wirzeniu at cc.helsinki.fi



More information about the Comp.lang.c mailing list