C++ - char** argv vs. char* argv[]

Simplicity picture Simplicity · Mar 4, 2011 · Viewed 49.3k times · Source

What is the difference between char** argv and char* argv[]? in int main(int argc, char** argv) and int main(int argc, char* argv[])?

Are they the same? Especially that the first part does not have [].

Answer

Fred Foo picture Fred Foo · Mar 4, 2011

They are entirely equivalent. char *argv[] must be read as array of pointers to char and an array argument is demoted to a pointer, so pointer to pointer to char, or char **.

This is the same in C.