I've got this function below that takes a string and reverses it in C, but only using pointers. However, for some reason, I get this error every single time. This code is almost copy and paste from a source after I tried to figure out what's wrong with it, yet it still isn't working. It breaks at the *end = *ptr, any ideas? I'm lost.
char* reverseOneString(char s[STRING_LENGTH])
{
s = "Testing";
char temp;
char* ptr = &s[0];
int len = strlen(s);
char* end = &s[0];
for (int i = 0; i < len - 1; i++) {
end++;
}
printf("%c, %c\n", *ptr, *end);
for (int i = 0; i < len / 2; i++) {
printf("Schwop");
temp = *end;
*end = *ptr;
*ptr = temp;
printf("%c", *end);
ptr++;
end--;
}
}