On Sat, 15 Dec 2007 10:30:55 +1100, Logan
Is char **argv equal to char *argv[]?
Only in certain contexts. With three exceptions, an expression (not a
declaration) with array type is converted to the address of the first
element with type pointer to element type.
So immediately you know that
char *argv1[10];
char **argv2;
produce very different type of objects.
However, given the above
argv2 = argv1;
is legal and is exactly equivalent to
argv2 = &argv1[0];
In the case of a function declaration, the actual arguments are
"passed" to the formal parameters as if by assignment. Consequently,
even if your parameter list specifies an array, the compiler knows
better and generates code to process the pointer that is actually
passed.
This is the reason that
char *x1 = "Hello,";
char x2[] = " world";
printf("%s%s\n", x1, x2)
works even though x1 is a pointer and x2 is an array.