C program to Reverse a Sentence Using Recursion #43
C program to Reverse a Sentence Using Recursion This program takes a sentence from user and reverses that sentence using recursion. This program does not use string to reverse the sentence or store the sentence. To understand this example, you should have the knowledge of following C programming topics: C Programming Functions C Programming User-defined functions C Programming Recursion Example: Reverse a sentence using recursion /* Example to reverse a sentence entered by user without using strings. */ #include <stdio.h> void reverseSentence (); int main () { printf ( "Enter a sentence: " ); reverseSentence (); return 0 ; } void reverseSentence () { char c ; scanf ( "%c" , & c ); if ( c != '\n' ) { reverseSentence (); printf ( "%c" , c ); } } Output Enter a sentence: margorp emosewa awesome program This program first p