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

#include <stdio.h>

void reverse(char *str)
{
if (*str == '\0')
return;

reverse(str+1);

printf("%c", *str);
}

int main()
{
char str[50];

printf("Enter the string: ");
scanf("%s", str);

printf("Reversed string: ");
reverse(str);
printf("\n");

return 1;
}

Is This Answer Correct ?    23 Yes 24 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are its uses in c programming?

1051


What is difference between array and structure in c?

1175


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

1119


what is the basis for selection of arrays or pointers as data structure in a program

4301


What is an lvalue?

1061


What is #include cctype?

1117


Write a program to reverse a linked list in c.

1115


What are the restrictions of a modulus operator?

1119


how to construct a simulator keeping the logical boolean gates in c

2251


Is it better to use malloc() or calloc()?

1106


What are variables and it what way is it different from constants?

1237


What is wrong with this program statement? void = 10;

1247


What are volatile variables in c?

936


What does a function declared as pascal do differently?

1118


Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon

2289