How to reverse a string using a recursive function, without
swapping or using an extra memory?
Answer Posted / vinay tiwari
void reverse(char *,int b);
void main()
{
char a[26];
int len;
clrscr();
printf("enter string ");
gets(a);
len=strlen(a);
reverse(a,len);
getch();
}
void reverse(char * a,int len)
{
if(len==0)
printf("%c",a[len]);
else
{
printf("%c",a[len]);
reverse(a,len-1);
}
}
Is This Answer Correct ? | 177 Yes | 62 No |
Post New Answer View All Answers
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.
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
Explain how do you determine whether to use a stream function or a low-level function?
What is the most efficient way to store flag values?
What is the translation phases used in c language?
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
How is pointer initialized in c?
What is variable and explain rules to declare variable in c?
Should I learn data structures in c or python?
What is the difference between far and near ?
How can I make it pause before closing the program output window?
Do pointers take up memory?
Which one would you prefer - a macro or a function?
Where is volatile variable stored?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);