My teacher gave me a correction of an exercise and it contains code using double pointers. Since I am fairly new to C I have difficulty comprehending what the code does. I know the basics of a single pointer ,but somehow I lose my way on the double pointer route.
The code:
#include <stdio.h>
main(int argc, char** argv){
printf("\nHello ");
char** runner = argv;
++runner;
while(*(runner+2) != 0){
**runner = toupper(**runner);
printf("%s, ",*runner);
++runner;
}
**runner = toupper(**runner);
printf("%s ",*runner);
++runner;
**runner = toupper(**runner);
printf("and %s!",*runner);
}
-The first issue I have is understanding why the main function uses a double pointer? -The second issue ,after initializing the double pointer ,runner, it is being told to point to one place further. But how on earth can you know where it points to ,if it points to a pointer which in its own turn points to a place you have no idea of?
- Since I have problems understanding these first two things I can't continue and don't know how the code further works.
Thank you for your time