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 ## preprocessor operator in c?
What is the importance of c in your views?
Is a house a shell structure?
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.
cavium networks written test pattern ..
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
FILE PROGRAMMING
When can you use a pointer with a function?
What is the collection of communication lines and routers called?
how to count no of words,characters,lines in a paragraph.
What is the difference between a string and an array?
What does nil mean in c?
How do you use a pointer to a function?
What is spaghetti programming?
using only #include