first prints Enter a sentence
: . Then, the reverseSentence()
function is called.c
. If the variable is any character other than \n (newline)
, reverseSentence()
is called again.reverseSentence()
function starts printing characters from last.#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);
}
}
Enter a sentence: gininraeL emiT eerF
Free Time Learninig