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
What is c programing language?
Explain about C function prototype?
Why void main is used in c?
Is c is a high level language?
code for find determinent of amatrix
What is wrong with this code?
Difference between constant pointer and pointer to a constant.
can any one provide me the notes of data structure for ignou cs-62 paper
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.
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
How main function is called in c?
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
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.
What are high level languages like C and FORTRAN also known as?
What are the advantages of using Unions?