Assume I have char **argv
.
First, how can I print out all the strings in argv
? I tried the following:
char *temp;
temp = *argv; // Now points to the first string?
while (temp != NULL) {
printf("%s ", temp);
temp++;
}
In here, when temp
is incremented, it only skips one character. Why is that happening? I know that argv
is an array that holds points. Each pointer, points to an array of char*
. If so, why isn't this working? I know that since temp
is of type char
, incrementing that pointer would increment it by 1
char (or byte). If so, how can I increment the pointer into the next array and print that string out?