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 are the advantages and disadvantages of c language?
Simplify the program segment if X = B then C ← true else C ← false
Tell me with an example the self-referential structure?
What is a memory leak? How to avoid it?
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......
Can we declare variables anywhere in c?
What are different types of variables in c?
Explain what is the benefit of using const for declaring constants?
Explain what is wrong with this program statement? Void = 10;
Without Computer networks, Computers will be half the use. Comment.
Write a Program to find whether the given number or string is palindrome.
What is the difference between declaring a variable by constant keyword and #define ing that variable?
What is a macro, and explain how do you use it?
Explain c preprocessor?