Our teacher wants us to write a program that reverses the order of a character array. So like if the user inputs "hello", the program will output "olleh".
Here's the function that we were given:
void reverse_string(char coolstring[11], char newcoolstring[11])
{
int count = 0, count2 = 0;
while(coolstring[count] != '\0')
{
count++;
}
count -= 1;
cout << coolstring[count];
system("pause");
while(coolstring[count] != 0)
{
newcoolstring[count] = coolstring[count2];
count -= 1;
count2 += 1;
}
}
but it doesn't work and I can't find out why while trying to make it work. Could you point me to the right direction?
Any help would be appreciated