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
hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel
What does *p++ do?
Why structure is used in c?
Explain what is gets() function?
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
What does 3 periods mean in texting?
How can I find the modification date and time of a file?
When can you use a pointer with a function?
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
Write a program with dynamically allocation of variable.
Explain how can I open a file so that other programs can update it at the same time?
Why is python slower than c?
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
Explain modulus operator. What are the restrictions of a modulus operator?
What is a keyword?