delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/13/11:33:08

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: char **argv vs. char *argv[]
Date: Mon, 09 Jun 1997 20:26:11 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 28
Message-ID: <339C66E3.3064@cs.com>
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> <339c1dee DOT 6520200 AT ursa DOT smsu DOT edu>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp105.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Tony O'Bryan wrote:
> 
> Maybe I misunderstood what you said, but gcc reports no errors with this program
> compiled with "gcc -Wall test.c":
> 
> int *Func1(int *Pointer)
>   {
>   Pointer += 5;
[snip]
> 
> int *Func2(int Pointer[])
>   {
>   Pointer += 5;
[snip]

According to my C reference and my understanding of the language, when
you specify empty brackets for an array-type variable in an argument
list, the compiler handles the variable identically to one explicitly
defined as a pointer.  In essence, *[] and ** have identical
functionality.  A little bird once told me that *argv[] was not 100%
portable; however, I've never seen a problem with it.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I |     mailto:fighteer AT cs DOT com      |
| Proud owner of what might one   |   http://www.cs.com/fighteer    |
| day be a spectacular MUD...     | Plan: To make Bill Gates suffer |
---------------------------------------------------------------------

- Raw text -


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