argv[0] is the name of the program that was invoked on the command line. If you typed ./myprogram --help , then argv[0] will be "./myprogram".
argv[0][1] will be the second character of this line, '/' in the above example.
Let's see that for (argc--, argv++; argc > 0; argc -= argCount, argv += argCount) :
It initializes the loop by running argc-- , then argv++ ( argv now points to the second line of user parameters), and argc declares an argument less.
The loop for all arguments argc>0 , and at each iteration the number of processed arguments argCount is removed from the number of all arguments argc . It makes sense.
However, switch (**argv[0][1]) makes no sense, argv[0][1] is a char , as noted earlier, and not a pointer, so it cannot be dereferenced.
source share