argv[] terminated by a NULL pointer?

Hopelessly in love w/Donna Reed angst at cs.ucsb.edu
Sun Jun 23 10:48:30 AEST 1991


[I looked in the FAQ and this wasn't mentioned.]

I'm porting some code that assumes that the argv[] array is terminated
by a NULL pointer, rather than just using argc to determine the number
of arguments passed to the program.

I was always taught to use argc, and was of the belief that argv[] is
not necessarily terminated by a NULL pointer.

The only reason I can come up with for people thinking that it is
terminated with a NULL pointer is the calling syntax for the the 
different forms of exec, which require the argument array to be
terminated by a NULL.

So I guess my question is: am I right in my belief that argv[] 
is not *guaranteed* to be terminated by a NULL pointer?  

Thanks.

"Let the fools have their tartar sauce."	|          Dave Stein
  		        - Mr. Burns		|       angst at cs.ucsb.edu
						|    angst%cs at ucsbuxa.bitnet



More information about the Comp.lang.c mailing list