void RevStr (char *str){
char ch = '\0';
if (*str){
ch = *str;
RevStr (++str);
}
printf ("%c", ch);
}
On Fri, Sep 24, 2010 at 12:37 AM, Nishant Agarwal <
nishant.agarwa...@gmail.com> wrote:
>
> @Albert
> i think this should be right
>
> static int i=0;
> int j;
> void xstrrev(char *s)
> {
>
@Albert
i think this should be right
static int i=0;
int j;
void xstrrev(char *s)
{
char t;
if(i==0)
j=strlen(s)-1;
if(iwrote:
> Ur function prototype is not similar to one i posted before
>
> check it out
>
> --
> You received this message because you are subscribed
*...@nisanth : help me plz... to solve this
finding largest and second largest elements from a set of n elements by
means of
Minimum comparison of n+celling(log n) +2*
On Thu, Sep 23, 2010 at 1:50 PM, Nishant Agarwal <
nishant.agarwa...@gmail.com> wrote:
> i am giving the full code
i am giving the full code
#include
#include
#include
void xstrrev(char *s , int i , int j)
{
char t;
if(i 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
@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 {
> t=s[i];
> s[i]=s[j];
> s[j]=t;
> xstrrev(s,i+1,j-1);
>
> }
> }
>
Ur function prototype is not similar to one i posted before
check it out
--
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
void xstrrev(char *s , int i , int j)
{
char t;
if(i 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 proto
Sorry ...correction we have to bring temp2 to last char again... so
char* temp, temp2;
char* s="Nitin";
for(temp2=s;*temp2='\0';temp2++ );/*just to calculate the length of s*/
--temp2; *<===*
void strrev(char * s,char* temp2)
{ if (s==temp2 ||s>temp2)
{return;}
char* temp, temp2;
char* s="Nitin";
for(temp2=s;*temp2='\0';temp2++ );/*just to calculate the length of s*/
void strrev(char * s,char* temp2)
{ if (s==temp2 ||s>temp2)
{return;}
*temp = *s;
*s=* temp2;
*temp2=*temp;
temp2++;
s++;
strrev(*s,*temp2)
}
But it
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
10 matches
Mail list logo