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


what is the use of operator ^ in C ? and how it works?

Answers were Sorted based on User's Feedback



what is the use of operator ^ in C ? and how it works?..

Answer / vinay sachan

exclusive OR ^ is a bitwise operator known as (left assoc).

expr1 ^ expr2

ex.

0x12 ^ 0x58

returns 0x4A (the set bits in the result are those that are set in either 0x12 or 0x58, but not set in both).

Is This Answer Correct ?    7 Yes 0 No

what is the use of operator ^ in C ? and how it works?..

Answer / rahul mathur

^ is a exclusive OR bitwise operator.

We can use this "^" operator for swaping two values without
using third variable and without using +, - operator as
shown below:

void xorSwap (int *x, int *y) {
if (x != y) {
*x ^= *y;
*y ^= *x;
*x ^= *y;
}
}

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More C Interview Questions

Without Computer networks, Computers will be half the use. Comment.

0 Answers  


What is wrong in this statement? scanf(“%d”,whatnumber);

0 Answers  


What is #include cctype?

0 Answers  


how can we print  hellow world programme without using semicolon

3 Answers  


Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

5 Answers   TCS, Vimukti Technologies,


Can a variable be both const and volatile?

0 Answers  


what is the difference b/w compiler and debugger?

2 Answers   Assurgent,


The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none

0 Answers  


what is the program to display your name in any color?

2 Answers   HCL,


How can I discover how many arguments a function was actually called with?

0 Answers  


write a program whose output will be- 1 12 123 1234

10 Answers  


What are the modifiers available in c programming language?

0 Answers  


Categories