Write a recursive function void mirror(void) that reads character by character (using
the function getchar()) a string terminated by ? and then displays the string in reverse order.void main(){ mirror();}
Difficulty level
This exercise is mostly suitable for students
void mirror()
{
char c;
c=getchar();
if(c!='?')
mirror();
putchar(c);
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Real and complex solutions of a second degree equation