write a program to swap Two numbers without using temp variable.
Answer Posted / dhruv
I am not giving an answer, but just wanted to point out that
most of the solutions which try to add (a+b) and then
subtract from it will not work if (a+b) exceeds the maximum
value an int can hold.
So even if it looks good on paper it will give erroneous
results when run on a machine
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is a void pointer in c?
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
What is a loop?
the question is that what you have been doing all these periods (one year gap)
What is the difference between declaring a variable by constant keyword and #define ing that variable?
What is difference between main and void main?
Is it fine to write void main () or main () in c?
What is function prototype in c with example?
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.
How many bytes are occupied by near, far and huge pointers (dos)?
What are the types of type specifiers?
What do you mean by recursion in c?
Is Exception handling possible in c language?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?