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 / right

char* reverseStringR(char* string){
if(string[0] && !string[1])
return string;

char first = string[0];

reverseStringR(string+1);
size_t length_rest = strlen(string+1);
memmove(string, string+1, length_rest);
string[length_rest] = first;

return string;
}

Is This Answer Correct ?    3 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why clrscr is used after variable declaration?

1638


Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.

5301


Explain #pragma statements.

988


Can 'this' pointer by used in the constructor?

1049


Write a C program to count the number of email on text

1866


what is a function method?give example?

2327


Explain pointer. What are function pointers in C?

1026


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

953


What is const and volatile in c?

997


Explain what are bus errors, memory faults, and core dumps?

1233


Is printf a keyword?

1164


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

1640


shorting algorithmS

2213


What is the equivalent code of the following statement in WHILE LOOP format?

1259


What are pointers? What are different types of pointers?

1076