I am trying to understand this algorithm, which reverses a C-style character in-place. I don't understand what the *
indicates in the context of being before a string and in the context of "char * end." Thanks for your help!
void reverse(char *str) {
char * end = str;
char tmp;
if (str) {
while (*end) {
++end;
}
--end;
while (str < end) {
tmp = *str;
*str++ = *end;
*end-- = tmp;
}
}
}