#include<stdio.h>
#define MAX 10000
char* getReverse(char str[]){
static int i=0;
static char rev[MAX];
if(*str){
getReverse(str+1);
rev[i++] = *str;
}
return rev;
}
int main(){
char str[MAX],*rev;
printf("Enter string: ");
scanf("%s",str);
rev = getReverse(str);
printf("Reversed string is: %s",rev);
return 0;
}
No comments:
Post a Comment