i am giving the full code.... #include<stdio.h> #include<stdlib.h> #include<string.h> void xstrrev(char *s , int i , int j) { char t; if(i<j) { t=s[i]; s[i]=s[j]; s[j]=t; xstrrev(s,i+1,j-1); } } int main() { char *s; s=(char *)malloc(sizeof(s)); gets(s); xstrrev(s,0,strlen(s)-1); puts(s); return 0; }
On Fri, Sep 24, 2010 at 12:15 AM, coolfrog$ <dixit.coolfrog.div...@gmail.com > wrote: > @nishant: > what is i and j..??? > @ > > On Thu, Sep 23, 2010 at 1:20 PM, Nishant Agarwal < > nishant.agarwa...@gmail.com> wrote: > >> void xstrrev(char *s , int i , int j) >> { >> char t; >> if(i<j) >> { >> t=s[i]; >> s[i]=s[j]; >> s[j]=t; >> xstrrev(s,i+1,j-1); >> >> } >> } >> >> On Thu, Sep 23, 2010 at 11:29 PM, Albert <alberttheb...@gmail.com> wrote: >> >>> How to reverse a String using recursion in C without using any extra >>> memory? >>> >>> the question seems to be simple..... >>> >>> char* strrev(char *) >>> { >>> ... >>> ... >>> ... >>> } >>> >>> >>> Try to give all the answers for this prototype..... >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algoge...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >>> >> >> >> -- >> .... :-) >> ***************************************** >> Nishant Agarwal >> Computer Science and Engineering >> NIT Allahabad >> ***************************************** >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algoge...@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- .... :-) ***************************************** Nishant Agarwal Computer Science and Engineering NIT Allahabad ***************************************** -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.