I'm trying to understand how pointers work and I'm stuck at this line
for (p = s + strlen(s) - 1; s < p; s++, p--)
I don't understand p what it's equated to. can anyone help me?
here's the full code.
void Reverse(char *s){
char c, *p;
for (p = s + strlen(s) - 1; s < p; s++, p--){
c = *s;
*s = *p;
*p = c;
}
}
int main(){
char ch[] = "!dlroW olleH";
Reverse(ch);
printf("%s", ch);
return 0;
}