Why are argvs act odd? Example:
This will work as expected, print the 1st character of the 1st argument.
printf("%c", *argv[1]);
This however will print the character that's in the ascii table (aka "one bigger" represented as a number) instead of printing the 2nd character of the 1st argument:
printf("%c", *(argv[1] + 1);
Slight modifications will do nothing, exact same result:
printf("%c", *(argv[1] + sizeof(char));
The only thing that helps is actually casting argv[2] to char*:
printf("%c", *( (char*)(argv[1] +1 ) );
Why is this happening? I kno that:
argv's type := char** argv
and argv[1] == *(argv + 1)
and argv[1]'s type should be char*
but apparently it is not, as I need to cast it? How is this possible? It is declared as char**, yet its members aren't char*s?