need help with pointer

can anyone help me rewrite the function i wrote below using only points and pointer increment/decrement? I dont have much experience with pointer so I dont know what to do.

1
2
3
4
5
6
7
8
9
10
11
void reverse(char * s)
{
    int i, l = strlen(s);
    char c;
    for(i = 0; i < (l >> 1); i++)
    {
        c = s[i];
        s[i] = s[l - i - 1];
        s[l - i - 1] = c;
    }
}


do not use pointer arithmetic or array notation.
any help or hint on how to rewrite the function above is appriciated.
Thanks!
I have no idea what your asking for?
But the following also works.

1
2
3
4
5
6
7
8
9
10
11
void reverse(char * s)
{
    int i, l = strlen(s);
    char c;
    for(i = 0; i < (l >> 1); i++)
    {
        c = *(s + i);
        *(s + i) = *(s + l - i - 1);
        *(s + l - i - 1) = c;
    }
}
Topic archived. No new replies allowed.