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

What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?

0 Answers  


Define C in your own Language.

0 Answers   Motorola,


whether itis a structured language?

1 Answers   Microsoft,


how can we use static and extern?and where can we use this?

3 Answers   Excel,


my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?

0 Answers  


pgm to reverse string using arrays i.e god is love becomes love is god) (assumption:only space is used for seperation of words) no addtional memory used.i.e no temporary arrays can used.

4 Answers   Persistent, Valyoo,


How can you pass an array to a function by value?

0 Answers  


25. It takes five minutes to pass a rumour from one person to two other persons. The tree of rumour continues. Find how many minutes does it take spread the rumour to 768 persons. ?

11 Answers   CTS, TCS,


Explain what is the benefit of using #define to declare a constant?

0 Answers  


How do I declare a pointer to an array?

6 Answers   IBM,


What does == mean in texting?

0 Answers  


Explain what is the advantage of a random access file?

0 Answers  


Categories