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$ <[email protected]
> wrote:
> @nishant:
> what is i and j..???
> @
>
> On Thu, Sep 23, 2010 at 1:20 PM, Nishant Agarwal <
> [email protected]> 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 <[email protected]> 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 [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<algogeeks%[email protected]>
>>> .
>>> 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 [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<algogeeks%[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]<algogeeks%[email protected]>
> .
> 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 [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.