As above, if you're using C++, why not use the string alias? Otherwise, in C, you can do this with recursion pretty easy too. Here's a method I wrote a while back:
#include <stdio.h>
#include <string.h>
void reverse_str_recur(char *s, int lower_index, int upper_index)
{
if (upper_index <= lower_index) return;
char c[2] = {s[lower_index], s[upper_index]};
memcpy(s + lower_index, c + 1, 1);
memcpy(s + upper_index, c, 1);
reverse_str_recur(s, upper_index - 1, lower_index + 1);
}
void reverse_str(char *s)
{
reverse_str_recur(s, 0, strlen(s) - 1);
}
int main()
{
char str[] = "12345";
printf("Original: %s\n", str);
reverse_str(str);
printf("Reversed: %s\n", str);
return 0;
}
Just remember with C style strings you have a null terminator to work with.