The reverse function is easily done using a for loop and a swap-value function (which you write).
You can also do the concatenate function yourself using a for loop (or two).
I have no idea how you could do it easily with recursion, since you cannot return a string (are not allowed to use string objects).
Code:
void Swap(char* C1, char* C2)
{
char Temp = *C1;
*C1 = *C2;
*C2 = Temp;
}
void Reverse(char* String)
{
int Length = strlen(String);
for(int i=0; i<(Length/2); i++)
{
Swap(&String[i], &String[Length - i - 1]);
}
}
void Concatenate(char* Buffer, char* S1, char* S2)
{
int i;
int L1 = strlen(S1);
int L2 = strlen(S2);
for(i=0; i<L1; i++)
{
Buffer[i] = S1[i];
}
for(i=0; i<L2; i++)
{
Buffer[L1 + i] = S2[i];
}
Buffer[L1 + L2] = '\0';
}
int main()
{
char Buffer[256];
char StrHello[16] = "Hello";
char StrHelloReverse[16] = "Hello";
Reverse(StrHelloReverse);
Concatenate(Buffer, StrHello, StrHelloReverse);
cout << Buffer;
return 0;
}