Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uflorida!haven!ncifcrf!nlm-mcs!adm!smoke!gwyn From: gwyn@smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: How big is the argv[] array? Message-ID: <8631@smoke.ARPA> Date: 5 Oct 88 05:01:56 GMT References: <1239500004@osiris.cso.uiuc.edu> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 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? What puzzles me is the line of reasoning you would use to conclude that accessing nonexistent data could ever be safe. argv[argc] is supposed to be a null pointer, and as you note you can test for that instead of using a counter. (However, getopt() works best with the counter approach.) Some older systems did not have a null pointer in argv[argc], however. I don't think you're likely to encounter any such systems today. argv[argc+1] is simply undefined. Any use of it would be at your own risk; in other words: don't do it.