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

Why c++ is called oop?

1054


Is swift faster than go?

1043


What are virtual functions in c++?

1121


What are the advantages of using const reference arguments in a function?

1021


What is scope operator in c++?

1036


What is stl containers in c++?

990


What is the difference between #import and #include in c++?

1058


Perform addition, multiplication, subtraction of 2-D array using Operator Overloading.

3794


What is the object serialization?

1093


What is null and void pointer?

997


If you want to share several functions or variables in several files maitaining the consistency how would you share it?

928


What is the difference between global variables and static varables?

1069


What are the advantages of early binding?

1012


What sorting algorithm does c++ use?

1080


Is c++ a good first language to learn?

1015