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 / siva kumar

void reverse_string(char *string) {

static int start_index = 0;
static int end_index = strlen(string) - 1;

if (start_index <= end_index) {
char temp = string[end_index];
string[end_index] = string[start_index];
string[start_index] = temp;
start_index++;
end_index--;
reverse_string(string);
}
}

Is This Answer Correct ?    11 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the advantages and disadvantages of macros.

1105


Why is c used in embedded systems?

1123


what are the different storage classes in c?

1184


What is far pointer in c?

1313


Why is c called c?

1025


What are data structures in c and how to use them?

1172


What is class and object in c?

1123


Explain what is wrong with this program statement? Void = 10;

1265


What is the best organizational structure?

1123


How many data structures are there in c?

1123


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4688


Do pointers need to be initialized?

1084


Explain what will the preprocessor do for a program?

1069


How can I do peek and poke in c?

1080


What functions are used for dynamic memory allocation in c language?

1153