How can I reverse a string in C by just giving a char* and the length as input parameters and recieving the reversed string as output? Also, without using the strrev function. Just by usign loops?
EDIT: Okay thats how I did it now:
char* __stdcall Reverse(char *str, int length, char* *out)
{
char *s = str;
char *end = s + length - 1;
for (; s < end; ++s, --end) {
char ch = *end;
*end = *s;
*s = ch;
}
*out = str;
}