References for int type variable
#include <iostream>
using namespace std;
void swap(int *a, int *b);
main(void)
{
int x, y;
x = 99;
y = 88;
cout << x << " " << y << "\n";
swap(&x, &y);
cout << x << " " << y << "\n";
return 0;
}
void swap(int *a, int *b)
{
int t;
t = *a;
*a = *b;
*b = t;
}
Related examples in the same category