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...

write a C code
to reverse a string using a recursive function, without
swapping or using an extra memory.

Answer Posted / jainendra

#include<stdio.h>
#define MAX 100
char* getReverse(char[]);

int main(){

char str[MAX],*rev;

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

rev = getReverse(str);

printf("Reversed string is: %s",rev);
return 0;
}

char* getReverse(char str[]){

static int i=0;
static char rev[MAX];

if(*str){
getReverse(str+1);
rev[i++] = *str;
}

return rev;
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is c programing language?

1052


Explain about C function prototype?

1037


Why void main is used in c?

1014


Is c is a high level language?

1141


code for find determinent of amatrix

1926


What is wrong with this code?

1138


Difference between constant pointer and pointer to a constant.

1079


can any one provide me the notes of data structure for ignou cs-62 paper

2130


Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.

1608


which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above

2017


How main function is called in c?

1080


why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

1102


write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.

2046


What are high level languages like C and FORTRAN also known as?

1121


What are the advantages of using Unions?

1077