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 / prasenjit roy

#include <stdio.h>

//No restrinction of datatype
#define SWAP(x,y) { x = x ^ y; \
y = x ^ y; \
x = x ^ y; \
}

void main()
{
char c = 'c';
char d = 'd';
SWAP(c, d);
}

Is This Answer Correct ?    13 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How are pointers type-cast?

1071


What is a c++ object?

1112


What is a class template?

1037


Why null pointer is used?

1004


What is c++ hiding?

1133


Can c++ be faster than c?

995


Write about the various sections of the executable image?

946


Is it possible for a member function to delete the pointer, named this?

1104


If you don’t declare a return value, what type of return value is assumed?

903


Why we use #include iostream in c++?

1014


Can manipulators fall in love?

968


What is std :: endl?

982


How many different levels of pointers are there?

1176


What are the uses of c++ in the real world?

993


Is c++ the hardest language?

949