Name: Anonymous 2007-11-25 18:06
i have the following function:
char * find(const char * s1, const char * s2)
{ /* whatever */ }
Inside I move the s2 pointer with *s2++; How do I reset *s2 to point at the beginning of the string? I tried to make a counter and do it like this:
int counters2 = 0;
(later)
*s2++;
counters2++;
(later)
s2-=counters2++;
but it says "cannot modify a const object". What do I do?
char * find(const char * s1, const char * s2)
{ /* whatever */ }
Inside I move the s2 pointer with *s2++; How do I reset *s2 to point at the beginning of the string? I tried to make a counter and do it like this:
int counters2 = 0;
(later)
*s2++;
counters2++;
(later)
s2-=counters2++;
but it says "cannot modify a const object". What do I do?