Check out my solution above :) Its reversing the string On Tue, Jun 28, 2011 at 1:56 PM, shady <[email protected]> wrote:
> no, you arent actually reversing anything, you are just printing. > > > On Tue, Jun 28, 2011 at 11:40 AM, Kamakshii Aggarwal < > [email protected]> wrote: > >> >> #include <stdio.h> >> #include <stdlib.h> >> >> void revers(char *s) >> { >> >> if(*s) >> { >> revers(++s); >> s--; >> printf("%c ",*s); >> } >> >> } >> >> int main(int argc, char *argv[]) >> { >> char arr[]="string"; >> revers(arr); >> >> system("PAUSE"); >> return 0; >> } >> >> acording to above given definition of temporary variable will the above >> code also work for this question??? >> >> On Mon, Jun 27, 2011 at 11:56 PM, Swathi <[email protected]> wrote: >> >>> it works perfectly >>> >>> >>> On Mon, Jun 27, 2011 at 11:53 PM, hary rathor <[email protected]>wrote: >>> >>>> this solution according to sameer statement solution if there is any >>>> problem then pls tell me . here string or char is not being >>>> store anywhere >>>> >>>> char * reverse(char *str,int i ,int j) >>>> { >>>> while(i<j) >>>> { >>>> >>>> str[i]=str[i]^str[j]; >>>> str[j]=str[i]^str[j]; >>>> str[i]=str[i]^str[j]; >>>> i++;j--; >>>> } >>>> return str; >>>> } >>>> >>>> int main () >>>> { >>>> char str[]="harish"; >>>> printf("%s",reverse(str,0,sizeof(str)-2)); >>>> return 0; >>>> >>>> } >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> 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 [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> Regards, >> Kamakshi >> [email protected] >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- **Regards SAGAR PAREEK 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
