Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is a void pointer in c?

1046


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?

1050


Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)

980


What is a loop?

966


the question is that what you have been doing all these periods (one year gap)

2017


What is the difference between declaring a variable by constant keyword and #define ing that variable?

3290


What is difference between main and void main?

1118


Is it fine to write void main () or main () in c?

968


What is function prototype in c with example?

1005


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.

4154


How many bytes are occupied by near, far and huge pointers (dos)?

1117


What are the types of type specifiers?

985


What do you mean by recursion in c?

1058


Is Exception handling possible in c language?

1994


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1900