Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: How big is the argv[] array? Message-ID: <1988Oct4.174959.17742@utzoo.uucp> Organization: U of Toronto Zoology References: <1239500004@osiris.cso.uiuc.edu> Date: Tue, 4 Oct 88 17:49:59 GMT In article <1239500004@osiris.cso.uiuc.edu> hood@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@zoo.toronto.edu