Hi,
I've got character pointer, pointing to a string. I want to reverse character without using any other variable. The function is as fallow:
void reverseString(char* str)
{
int len = strlen(str);
int index = 0;
int count = len/2;
int end = len-1;
for(int i=0;i<count;i++)
{
char temp = *(str+index);
*(str+index) = *(str+end); //Crashes here
*(str+end) = temp;
index++;
end--;
}
}
But the program crashes at line *(str+index) = *(str+end)
What 's the issue with that?
Thanks,
Khurram.