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 character constants?
what is the height of tree if leaf node is at level 3. please explain
What are shell structures used for?
What are reserved words with a programming language?
What is the use of printf() and scanf() functions?
What are the advantages and disadvantages of c language?
what will be maximum number of comparisons when number of elements are given?
what is a constant pointer in C
Explain can static variables be declared in a header file?
Which of these functions is safer to use : fgets(), gets()? Why?
When should the const modifier be used?
Can the curly brackets { } be used to enclose a single line of code?
general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only
What is the best style for code layout in c?
What is malloc calloc and realloc in c?