Possible Duplicate:
In C, are arrays pointers or used as pointers?
In C++, the default main function can have arguments like char* argv[]. What is the its difference from char** and char* argv[100] ?
Possible Duplicate:
In C, are arrays pointers or used as pointers?
In C++, the default main function can have arguments like char* argv[]. What is the its difference from char** and char* argv[100] ?
There is no difference in function parameters. In other situations, the first declares a pointer, the second declares an array.
char**
is a pointer to a pointer to a char
.
The second char *argv[100]
is an array of pointers to a char.
But when you pass an array to functions they decay to a pointer.
char** argv
: To elicit the same behavior as char* argv[100] you must dynamically allocate space to store char pointers. For example: (*argv) = new char[100];
Double pointers are a very flexible datatype unique to C++ which can grant insane speed and insane bugs. Generally if you know the size of your array, its best to avoid dynamic memory allocation.