When you want to handle command-line arguments, you can define the main
function like the below.
int main(int argc, char **argv) { ... }
or
int main(int argc, char *argv[]) { ... }
In many websites, it is explained that the first argv
is a pointer to a pointer, and the second one is an array of pointers. But, is this true? Actually, even when you use the second definition, you can set argv
as the LHS of =
operator, which I think isn't allowed if argv
is truly an array. In my opinion, "when written as a function's parameter", char **argv
and char *argv[]
are completely equal. However, I haven't found the evidence.
Could anyone help me? (What I would like to have is strictly or officially written evidence.)
Note: I've already read the threads below. I believe my post isn't a duplicate of them.