delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/09/11:34:04

From: "A. Sinan Unur" <asu1 AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: char **argv vs. char *argv[]
Date: Mon, 09 Jun 1997 09:03:28 -0400
Organization: Cornell University http://www.cornell.edu
Lines: 45
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <339BFF1F.4897@cornell.edu>
References: <5ndap9$mgd AT freenet-news DOT carleton DOT ca> <01bc74bd$7df85940$e38033cf AT pentium> <5ngpcv$a6v$3 AT sun1000 DOT pwr DOT wroc DOT pl>
Reply-To: asu1 AT cornell DOT edu
NNTP-Posting-Host: cu-dialup-0001.cit.cornell.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Springman wrote:
> 
> In article <01bc74bd$7df85940$e38033cf AT pentium>, "Gil Myers" <gmeyers AT logan DOT net> says:
> >
> >Paul Derbyshire <ao950 AT FreeNet DOT Carleton DOT CA> wrote in article
> ><5ndap9$mgd AT freenet-news DOT carleton DOT ca>...
> >>
> >> I've seen char **argv and char *argv[] and am curious which is 
> >> correct.
> 
> > I don't think either is more correct than the other,  although 
> > *argv[] is most certainly used more.
> 
>         The *argv[] is used more probably because it is safer. Why?
> A basic example:
>         void func1 (int *p);
>         void func2 (int p[]);
> Both func1 and func2 accept pointers to ints as arguments. But they 
> are
> not exactly the same. The func2 takes a pointer that is constant, i.e.
> you'll get warnings when you try to modify its value.

uh-um ... what does that mean? no offense, but where exactly do you get
the notion that

void func2(int p[])
{
 p[0] = 42;
 return;
}

will generate a warning? these types of discussions belong in
comp.lang.c (and probably they are in the C FAQ.)

-- 
   Sinan
 
*******************************************************************
 A. Sinan Unur                                WWWWWW
                                              |--O+O
 mailto:sinan DOT unur AT cornell DOT edu                C   ^ 
 http://www.people.cornell.edu/pages/asu1/     \  ~/ 

Unsolicited e-mail is _not_ welcome, and will be billed for.
*******************************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019