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 difference between stdio h and conio h?
What does calloc stand for?
What is the difference between text and binary i/o?
Explain do array subscripts always start with zero?
Differentiate between new and malloc(), delete and free() ?
What does %c do in c?
Does * p ++ increment p or what it points to?
What is anagram in c?
Explain what is the difference between the expression '++a' and 'a++'?
What is c system32 taskhostw exe?
How would you rename a function in C?
Why can't I perform arithmetic on a void* pointer?
What are c identifiers?
general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only
By using C language input a date into it and if it is right?