Based on my understanding of pointer to pointer to an array of characters,
% ./pointer one two
argv
+----+ +----+
| . | ---> | . | ---> "./pointer\0"
+----+ +----+
| . | ---> "one\0"
+----+
| . | ---> "two\0"
+----+
From the code:
int main(int argc, char **argv) {
printf("Value of argv[1]: %s", argv[1]);
}
My question is, Why is argv[1] acceptable? Why is it not something like (*argv)[1]?
My understanding steps:
- Take argv, dereference it.
- It should return the address of the array of pointers to characters.
- Using pointer arithmetics to access elements of the array.