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