There is no benefit in swapping two numbers using a pointer. It's actually quicker to swap the two numbers themselves. However the following shows how to swap values by changing the pointers to those value.
#include <iostream>
int main()
{
int X = 5;
int Y = 6;
// Point to the values in X and Y.
int *pX = &X;
int *pY = &Y;
// Print current values and the values being pointed at:
std::cout << "Before swapping:" << std::endl;
std::cout << " X = " << X << ", Y = " << Y << std::endl;
std::cout << "pX = " << *pX << ", pY = " << *pY << std::endl;
// Swap the pointers.
pX = &Y;
pY = &X;
// Print current values and the values being pointed at:
std::cout << "After swapping:" << std::endl;
std::cout << " X = " << X << ", Y = " << Y << std::endl;
std::cout << "pX = " << *pX << ", pY = " << *pY << std::endl;
return( 0 );
}
if (*&a > *&b) *&max = *&a; else *&max = *&b;
void swap (int &pa, int &pb) { *pa ^= *pb; *pb ^= *pa; *pa ^= *pb; }
if (n%2==0) sum=n/2*(n+1); else sum=(n+1)/2*n;
How do you lose weight using super nos pump
If both Windows and Unix are using TCP/IP as their primary NOS there isn't much difference to speak of.
Miguel nos/se lo sirvio. ('Nos' - us. 'Se' - them)
Use a linked-list.
* Nob.s * Nog.s * Nor * Nos * Not
"Nos."
Nos is short for Numbers.
The Nos kid is a mythical beast who is addicted to the Nos energy drink, and cheesy nos jokes (replacing not with nos). It has blindingly white skin, and flosses with organic floss.
Nos. Amp