delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/13/00:25:06

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: char **argv vs. char *argv[]
Date: Thu, 12 Jun 1997 08:48:27 -0700
Organization: Alcyone Systems
Message-ID: <33A01A4B.760FDEA5@alcyone.com>
References: <5ndap9$mgd AT freenet-news DOT carleton DOT ca> <01bc74bd$7df85940$e38033cf AT pentium>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
Lines: 24
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gil Myers wrote:

> They are both the same thing.  The array syntax is interchangable with
> pointer
> arithmetic.  Or at least should be if the compiler in question follows
> the
> language
> at all.

Be careful with such statements.  Arrays and pointers are _not_ the same
thing.  In function arguments, however, an argument of array type is
silently treated as an argument of pointer type.  So char **argv and char
*argv[] are precisely the same.

That only applies to function arguments, however; arrays and pointers are
different entities.

-- 
       Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
                     Alcyone Systems /   web / http://www.alcyone.com/max/
San Jose, California, United States /  icbm / 37 20 07 N  121 53 38 W
                                   \
     "Covenants without the sword / are but words."
                                 / Camden

- Raw text -


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