How big is the argv[] array?
Henry Spencer
henry at utzoo.uucp
Wed Oct 5 03:49:59 AEST 1988
In article <1239500004 at osiris.cso.uiuc.edu> hood at osiris.cso.uiuc.edu writes:
>How big is the argv[] array? Or to ask it another way, how safe is it to
>go past the argc-1'th element in the argv[] array?
>
>Isn't it true that the array of pointers (or pointer to pointers, depending
>on your point of view) "argv" actually contains argc+1 elements, and not
>argc elements?
That is correct. argv[argc] is guaranteed to exist and be NULL, and thus
argv has argc+1 elements (argc arguments plus the NULL). Trying to access
argv[argc+1] or higher, however, is not safe.
--
The meek can have the Earth; | Henry Spencer at U of Toronto Zoology
the rest of us have other plans.|uunet!attcan!utzoo!henry henry at zoo.toronto.edu
More information about the Comp.lang.c
mailing list