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
Should I learn data structures in c or python?
Which built-in library function can be used to match a patter from the string?
Is swift based on c?
Compare array data type to pointer data type
What is calloc()?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
What is volatile, register definition in C
What is the difference between the local variable and global variable in c?
What is the difference between the = symbol and == symbol?
what is a NULL Pointer? Whether it is same as an uninitialized pointer?
Explain the difference between exit() and _exit() function?
The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.
What is a lookup table in c?
When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.
Why is c known as a mother language?