how to swap two integers 1 and 32767 without using third
variable
Answer Posted / mani654mani
Int var1=1, var2=32767;
var1 = var1 + var2;
var1 = 1 + 32767 =32768;
var2 = var1 - var2;
var2 = 32768 - 32767 = 1;
var1 = var1 - var2;
var1 = 32768 - 1 = 32767;
So Now var1 = 32767 and var2 = 1
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is spark map function?
How can this be legal c?
How can I get random integers in a certain range?
When is the “void” keyword used in a function?
Difference between strcpy() and memcpy() function?
What are identifiers and keywords in c?
What are lookup tables in c?
how to construct a simulator keeping the logical boolean gates in c
What is cohesion in c?
Explain what is the heap?
How important is structure in life?
What does %d do in c?
Is there a built-in function in C that can be used for sorting data?
Explain how does flowchart help in writing a program?
Do character constants represent numerical values?