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 infinite loop?
What are the data types present in c?
What are lookup tables in c?
What is the value of uninitialized variable in c?
What is the difference between a string and an array?
Can you mix old-style and new-style function syntax?
What is pass by value in c?
If I have a char * variable pointing to the name of a function ..
What is array in c with example?
Explain how can I pad a string to a known length?
Write a program to generate the Fibinocci Series
What is nested structure?
How do we make a global variable accessible across files? Explain the extern keyword?
Does sprintf put null character?
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.