what is the purpose of the following code, and is there any
problem with the code?

void fn(long* p1, long* p2)
{ register int x = *p1;
register int y = *p2;
x ^= y;
y ^= x;
x ^= y;
*p1 = x;
*p2 = y;
}



what is the purpose of the following code, and is there any problem with the code? void fn(long..

Answer / senthil

exchanges "long data type" values referenced by pointers p1 and p2

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Interview Questions

Please list all the unary and binary operators in C.

3 Answers  


What is typedef struct in c?

0 Answers  


WHAT WILL BE OUTPUT OF BELOW CODE . . AND PLEASE EXPLAIN HOW IT COME .. #include<stdio.h> #include<conio.h> void main() { int k=20; printf("%d%d%d%d",k,k++,++k,k); getch(); }

25 Answers  


palindrome for strings and numbers----Can anybody do the prog?

6 Answers   CTS, TCS, Vipro Lifescience Pvt,


we all know about the function overloading concept used in C++ and we all learnt abt that.... but that concept is already came in C in a very smaller propotion ... my question is IN WHICH CONCEPT THERE IS A USE OF FUNCTION OVERLOADING IS USED in C language?????????????

4 Answers   Google,






Hi Every one...........I have been selected for the SBI Clerk. But i m one month Pregnanat. So anyone please suggest me, is they take any objection on my joining .

4 Answers   State Bank Of India SBI,


What is the purpose of realloc()?

0 Answers  


How many types of functions are there in c?

0 Answers  


Explain how do you determine the length of a string value that was stored in a variable?

0 Answers  


Is it better to use malloc() or calloc()?

0 Answers   Aspire, Infogain,


difference between c and c++?

2 Answers  


Predict the output or error(s) for the following: 25. main() { printf("%p",main); }

3 Answers   Google, ME,


Categories