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

What are single and multiple inheritances in c++?

1095


What is purpose of abstract class?

1070


What are enumerations?

1102


write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;

2003


What is difference between c++ 11 and c++ 14?

1092


When there is a global variable and local variable with the same name, how will you access the global variable?

1101


What is the object serialization?

1146


What is class definition in c++ ?

1083


Program to check whether a word is a sub-string or not of a string typed

2028


Does c++ have foreach?

1049


What do c++ programmers do?

1053


write a programme to get a character and thier ASCII value

3041


Write a program to find the reverse Fibonacci series starting from N.

1266


What is a multimap c++?

1198


What is the difference between a definition and a declaration?

1063