Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to reverse a string using a recursive function, with
swapping?

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
char a1[50]; //GLOABAL VAR.
void reverse(int);
void main()
{
int count=0;
printf("enter the string :");
scanf("%s",a1);
for(int i=0;a1[i]!='\0';i++)
count++;
reverse(count);
getch();
}

void reverse(int count1)
{
char temp;
static int i=0;
if(i<=count1/2)
{
temp=a1[i];
a1[i]=a1[count1-1];
a1[count1-1]=temp;
i++;
reverse(--count1);
}
else
printf("\nthe reversed string is :%s",a1);
}




thank u

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Discuss the function of conditional operator, size of operator and comma operator with examples.

1099


What are the key features in c programming language?

1008


Explain how are 16- and 32-bit numbers stored?

1210


What is difference between union and structure in c?

1073


How can I read a binary data file properly?

1089


How would you rename a function in C?

998


When should the const modifier be used?

1062


If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?

1201


What is the value of a[3] if integer a[] = {5,4,3,2,1}?

1031


How is actual parameter different from the formal parameter?

973


How can I find out if there are characters available for reading?

1058


typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

1587


What is void main ()?

1014


What is %lu in c?

1180


Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.

1219