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 %d and %i in c?
You have given 2 array. You need to find whether they will
create the same BST or not.
For example:
Array1:10 5 20 15 30
Array2:10 20 15 30 5
Result: True
Array1:10 5 20 15 30
Array2:10 15 20 30 5
Result: False
One Approach is Pretty Clear by creating BST O(nlogn) then
checking two tree for identical O(N) overall O(nlogn) ..we
need there exist O(N) Time & O(1) Space also without extra
space .Algorithm ??
DevoCoder
guest
Posted 3 months ago #
#define true 1
#define false 0
int check(int a1[],int a2[],int n1,int n2)
{
int i;
//n1 size of array a1[] and n2 size of a2[]
if(n1!=n2) return false;
//n1 and n2 must be same
for(i=0;i
How can I list all of the predefined identifiers?
Can you mix old-style and new-style function syntax?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
Why can't I perform arithmetic on a void* pointer?
What is the use of header?
How to declare pointer variables?
What is main () in c language?
a c code by using memory allocation for add ,multiply of sprase matrixes
What is #pragma statements?
Write a code to generate divisors of an integer?
What is n in c?
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent
What is an identifier?