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 the use of fflush() function?

1027


Is malloc memset faster than calloc?

1018


How can I write a function that takes a format string and a variable number of arguments?

1005


I have a varargs function which accepts a float parameter?

998


What is the use of getchar() function?

1076


Should I learn data structures in c or python?

977


Can a program have two main functions?

1065


What does do in c?

994


What is difference between Structure and Unions?

1188


write a program to print largest number of each row of a 2D array

2270


Define Spanning-Tree Protocol (STP)

1076


int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above

1223


In C programming, what command or code can be used to determine if a number of odd or even?

992


What is use of pointer?

1013


What is the process to generate random numbers in c programming language?

1100