#include<stdio.h> #include<string.h> void reverse(char*,int,int); main() { char a[100]; gets(a); reverse(a, 0, strlen(a)-1); printf("%s\n",a); return 0; } void reverse(char *x, int beg, int end) { char a, b, c; if ( beg >= end ) return; c = *(x+beg); *(x+beg) = *(x+end); *(x+end) = c; reverse(x, ++beg, --end); }
Hay friends .. AREA OF LANGUAGE IS TOO WIDE BUT NOW APPROXIMATE THEORY AND "C PROGRAMING CODES" ARE AVAILABLE . GOPAL KRISHNA "CHAUHAN"
Thursday, 20 September 2012
C program to reverse a string using recursion
Subscribe to:
Post Comments (Atom)
can you please help me in the concept of string reverse, each line of a file.using recursive function.
ReplyDeletefor eg:INPUT is hai one
hai two
OUTPUT:
hai two
hai one
TRY TO DO ,
DeleteHAI ONE IN 1 MODULE AND HAI TWO IN SECOND MO-DUAL . NOW RIGHT TO LEFT READ THE STRING AND DISPLAY . OR YOU CAN DO SWAPING ALSO FOR DISPLAYING THIS . MANY METHODS ARE THERE ....
thank u frnd.....can u please tell the c coding for finding memory usage of a system??????
DeleteSURE ..... SEE OTHER SAME POST OF YOUR'S
ReplyDelete