and how will swap without using temp variable ?

On Mon, Jun 27, 2011 at 10:07 PM, Vishal Thanki <vishaltha...@gmail.com>wrote:

> and yes, "s" will be stored in stack everytime you call the function,
> so its a temp variable..
>
> string reverse is a simple logic, just iterate i through 1 to n/2 and
> swap the i to n-i
>
> On Mon, Jun 27, 2011 at 10:06 PM, Vishal Thanki <vishaltha...@gmail.com>
> wrote:
> > this code will only print, it will not store the reverse string.
> >
> > On Mon, Jun 27, 2011 at 9:53 PM, Kamakshii Aggarwal
> > <kamakshi...@gmail.com> 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;
> >> }
> >> will s be counted as temporary variable in this?
> >> On Mon, Jun 27, 2011 at 8:57 PM, rShetty <rajeevr...@gmail.com> wrote:
> >>>
> >>> Reversing a String without using a temporary variable ?
> >>>
> >>>
> >>> Rajeev N B
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups
> >>> "Algorithm Geeks" group.
> >>> To post to this group, send email to algogeeks@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.
> >>>
> >>
> >>
> >>
> >> --
> >> Regards,
> >> Kamakshi
> >> kamakshi...@gmail.com
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@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.
> >>
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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.
>
>


-- 
  best wishes!!
Vaibhav Shukla
    DU-MCA

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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.

Reply via email to