RE: [Dev-C++] difference between char* argv[] and char *argv[]
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ho...> - 2002-04-08 14:09:49
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Jason Hardman
> Sent: Monday, April 08, 2002 1:17 AM
> To: Dev-C++; Daniel Glenfield
> Subject: Re: [Dev-C++] difference between char* argv[] and
> char *argv[]
>
> Even more confusing (<evil laugh>) is that you can write
> *argv[], or **argv and they are
> interchangeable. I'm not sure about argv[][] though -
> probably invalid.
In C & C++ a function argument defined as an array is the same as if it
was defined as a pointer. That is both are pointers (and not an array).
Consider the code:
unsigned long slen(char p[10])
{
unsigned long size=0;
while(*p++)
size++;
return size;
}
So **argv, *argv[] and argv[][] are the same thing as function arguments
(only). For normal code only the first 2 can be considered compatible.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|