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 macro for swapping integers

Answers were Sorted based on User's Feedback



Write a macro for swapping integers..

Answer / deepak

# define swap(a,b) a = a + b; b = a - b; a = a - b;

Is This Answer Correct ?    50 Yes 8 No

Write a macro for swapping integers..

Answer / suresh

swap(a,b) a^=b^=a^=b;

Is This Answer Correct ?    12 Yes 3 No

Write a macro for swapping integers..

Answer / balaji ramdoss

#define SWAP(a,b) b=a+b-(a=b)

Is This Answer Correct ?    19 Yes 12 No

Write a macro for swapping integers..

Answer / raku

#define SWAP(a,b) a=a+b-(b=a)

Is This Answer Correct ?    1 Yes 0 No

Write a macro for swapping integers..

Answer / sun

#define SWAP(a,b) (a^=b^=a^=b;)

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More OOPS Interview Questions

Why do pointers exist?

0 Answers  


#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; a.x = 22; int c = a.x; int *b = new int; cout << c; return 0; } option: No output 0 22 -(11) Will not compile

1 Answers   CTS, Wipro,


What is difference between multiple inheritance and multilevel inheritance?

0 Answers  


what is the difference between <stdio.h>and "stdio.h"?

5 Answers  


What is an example of genetic polymorphism?

0 Answers  


What is the main purpose of inheritance law?

0 Answers  


What is difference between abstraction and encapsulation?

0 Answers  


Can java compiler skips any statement during compilation time?

0 Answers  


What is encapsulation in ict?

0 Answers  


Write a program in c++ to read two floating point numbers and find their sum and average.

2 Answers  


WHAT IS THE DIFFERENCE BETWEEN ABSTRUCTION AND ENCAPSULATION? PLEASE EXPLAIN IT.

7 Answers   ETH,


what is use to destroy an object? illustrate.

5 Answers   TCS,


Categories