Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to reverse a string using a recursive function, without
swapping or using an extra memory?

Answer Posted / cmp

#include <stdio.h>
void print(char *s,int size){
if(size<0)
printf(" ");
else

{
printf("%c",*(s+size-1));
print(s,size-1);
}
}

void main(){
char *s={"aliveli"};
int size=0,i=0;

while(*(s+i)!='\0'){
size++;
i++;
}
print(s,size);
}

Is This Answer Correct ?    6 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What oops means?

996


What are pointers?

1093


Is array name a pointer?

1023


What are identifiers in c?

1197


What is an identifier?

1026


how can I convert a string to a number?

1080


What is ## preprocessor operator in c?

1074


How do you list a file’s date and time?

1060


How are pointers declared in c?

1054


What is an endless loop?

1267


What does p mean in physics?

1031


What are the keywords in c?

1117


Explain what header files do I need in order to define the standard library functions I use?

1164


Differentiate abs() function from fabs() function.

1000


How does selection sort work in c?

1026