candide wrote:
All of those are fundamentally the same type, the only real difference
is the semantics that the programmer considers (if any at all).
It is common to declare it as "char **argv", which is a "pointer to char
*" where char * is "pointer to a char".
The semantics of it that make sense is "a pointer to the first element
in an array of char *" where the char * represents "a pointer to the
first char in a null terminated string" (also called a string).
Hope this helps,
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity .net/wordpress/>
Hi,
>
K&R2 §5.10 tells that the second parameter to the main function,
usually called argv, has type pointer to character strings.
>
Some quotes from the book :
>
>
-------------------- 8< ----------------------------------------
"the second (argv, for argument vector) is a pointer to an array of
character strings"
>
"Since argv is a pointer to an array of pointers,"
>
"Since argv is a pointer to the beginning of the array of argument strings"
-------------------- >8 ----------------------------------------
>
>
In fact, argv is rather an array of strings, as explained in the
preceding § :
>
>
-------------------- 8< ----------------------------------------
"Compare the declaration and picture for an array of pointers:
char *name[] = { "Illegal month", "Jan", "Feb", "Mar" };"
-------------------- >8 ----------------------------------------
>
>
Right ?
>
Thanks
>
K&R2 §5.10 tells that the second parameter to the main function,
usually called argv, has type pointer to character strings.
>
Some quotes from the book :
>
>
-------------------- 8< ----------------------------------------
"the second (argv, for argument vector) is a pointer to an array of
character strings"
>
"Since argv is a pointer to an array of pointers,"
>
"Since argv is a pointer to the beginning of the array of argument strings"
-------------------- >8 ----------------------------------------
>
>
In fact, argv is rather an array of strings, as explained in the
preceding § :
>
>
-------------------- 8< ----------------------------------------
"Compare the declaration and picture for an array of pointers:
char *name[] = { "Illegal month", "Jan", "Feb", "Mar" };"
-------------------- >8 ----------------------------------------
>
>
Right ?
>
Thanks
is the semantics that the programmer considers (if any at all).
It is common to declare it as "char **argv", which is a "pointer to char
*" where char * is "pointer to a char".
The semantics of it that make sense is "a pointer to the first element
in an array of char *" where the char * represents "a pointer to the
first char in a null terminated string" (also called a string).
Hope this helps,
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity .net/wordpress/>