what is the use of operator ^ in C ? and how it works?
Answers were Sorted based on User's Feedback
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 |
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 |
What is #line used for?
Can we change the value of #define in c?
what is pointer ? what is the use of pointer?
Did c have any year 2000 problems?
create an SINGLE LINKED LISTS and reverse the data in the lists completely
int main() { unsigned char a = 0; do { printf("%d=%c\n",a,a); a++; }while(a!=0); return 0; } can anyone please explain me output????
Is exit(status) truly equivalent to returning the same status from main?
What is a MAC Address?
what is the other ways to find a logic to print whether a number is an even or odd wit out using % symbol??????? i know three different ways to print it. so i need any other different logic>>>>>
write a program that will read the temperature in Celsius and convert that into Fahrenheit.
What are global variables?
What is difference between %d and %i in c?