How to reverse a string using a recursive function, without
swapping or using an extra memory?
Answer Posted / sravani
#include<stdio.h>
void strrev(char *);
main()
{
char s1[10];
printf("enter the string:");
scanf("%s",s1);
strrev(s1);
}
void strrev(char *p)
{
int i,j;
i=0,j=strlen(p)-1;
char temp;
while(i<j)
{
temp=p[i];
p[i]=p[j];
p[j]=temp;
i++;
j--;
strrev(s1);
}
| Is This Answer Correct ? | 5 Yes | 5 No |
Post New Answer View All Answers
What is calloc malloc realloc in c?
What is difference between structure and union?
What is the difference between void main and main in c?
What is the difference between malloc() and calloc()?
Explain modulus operator.
What is linear search?
What are the types of i/o functions?
What is scope of variable in c?
can anyone suggest some site name..where i can get some good data structure puzzles???
What is 'bus error'?
Should I learn data structures in c or python?
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.
What are global variables?
Explain how do you override a defined macro?
What functions are in conio h?