Monday, November 9, 2009

Swap two numbers in-place

Swap two numbers in-place

#include <iostream>

using namespace std;

int main()
{
int a = 10, b = 20;

a^=b;
b^=a;
a^=b;

cout <<a <<b;
}

No comments:

Post a Comment