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...

Write a program to swap 2 chars without using a third
varable?
char *s = "A";
char *p = "B";

Answer Posted / rajesh rvp

#include <stdio.h>
int main ()
{
int i;
char c,d,temp;
scanf("%c %c",&c,&d);
If (toascii (c)>toascii (d))
{
temp=c;
c=d;
d=temp;
}
return 0;
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a virtual destructor? Explain the use of it?

950


Will the following program execute?

997


What can I use instead of namespace std?

1083


What is prototype for that c string function?

1085


Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function?

1209


Should I learn c++ c?

1006


Explain "const" reference arguments in function?

1003


Is c better than c++?

1028


Why isn't sizeof for a struct equal to the sum of sizeof of each member?

955


How is c++ different from java?

1003


Why is c++ still used?

1025


What are the methods of exporting a function from a dll?

1156


Which operator cannot overload?

997


If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?

1079


What is the difference between *p++ and (*p)++ ?

1301