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

Why is c so popular?

1123


Explain bit masking in c?

1090


Can variables be declared anywhere in c?

1045


Can a pointer be static?

1031


What is main () in c?

1024


Explain how do you print an address?

1097


What is static and volatile in c?

1182


why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above

1080


Find MAXIMUM of three distinct integers using a single C statement

1016


What are the primitive data types in c?

1014


How the c program is executed?

1088


What is %g in c?

1028


What does c mean in standard form?

1113


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

1111


Explain heap and queue.

1023