P
Pavel Sorokin
Hello,
This is probably a very dumb question, but I don't understand what's
the problem with the following code. It gives a memory access
violation on the marked line. I'm using VC++ 7.1.
void reverse(char* str, int start, int end)
{
for(int i=start; i<(start+end)/2; i++)
{
char buf = str;
int endIndex = end-i;
str = str[endIndex]; // <-- this causes an error
str[endIndex] = buf;
}
}
Thanks,
Pavel
This is probably a very dumb question, but I don't understand what's
the problem with the following code. It gives a memory access
violation on the marked line. I'm using VC++ 7.1.
void reverse(char* str, int start, int end)
{
for(int i=start; i<(start+end)/2; i++)
{
char buf = str;
int endIndex = end-i;
str = str[endIndex]; // <-- this causes an error
str[endIndex] = buf;
}
}
Thanks,
Pavel