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 scope and lifetime of a variable in c?
Which programming language is best for getting job 2020?
What is sizeof array?
Can math operations be performed on a void pointer?
Write a program to print factorial of given number without using recursion?
Describe dynamic data structure in c programming language?
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.
Which is the best website to learn c programming?
What does char * * argv mean in c?
What are enumerated types?
What is this infamous null pointer, anyway?
Explain what is page thrashing?
Is swift based on c?
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
What are qualifiers and modifiers c?