How to reverse a string using a recursive function, with
swapping?
Answer Posted / vignesh1988i
my next logic:::
#include<stdio.h>
#include<conio.h>
void reverse(char*,char*);
void main()
{
char a1[50],*p;
int count=0;
printf("enter the string:");
scanf("%s",a1);
for(int i=0;a[i]!='\0';i++)
count++;
p=a1+(count-1);
reverse(a1,p);
printf("the reversed one is : %s",a1);
getch();
}
void reverse(char *a1,char *p)
{
char temp;
if(a1<=p)
{
temp=*a1;
*a1=*p;
*p=temp;
reverse(++a1,--p);
}
}
thank u
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What language is c written?
Explain why c is faster than c++?
Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor
Is it cc or c in a letter?
Explain what is meant by high-order and low-order bytes?
What is I ++ in c programming?
What does the function toupper() do?
Apart from dennis ritchie who the other person who contributed in design of c language.
Write a program to know whether the input number is an armstrong number.
Is c is a middle level language?
What are different types of pointers?
What are local static variables?
What is the importance of c in your views?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
Tell me with an example the self-referential structure?