what is the use of operator ^ in C ? and how it works?
Answer Posted / 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 View All Answers
What is the right type to use for boolean values in c? Is there a standard type?
Can you think of a logic behind the game minesweeper.
How many identifiers are there in c?
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...
What is the difference between a function and a method in c?
What is difference between structure and union with example?
what is the difference between 123 and 0123 in c?
Why is c called a structured programming language?
How old is c programming language?
Can a pointer point to null?
Explain what is the purpose of "extern" keyword in a function declaration?
Hi can anyone tell what is a start up code?
What is 1f in c?
How do you define a function?
In c programming language, how many parameters can be passed to a function ?