what's inadequacy between func(int &param) func(int *param)?


in following code, both amp_swap() star_swap() seems doing same thing. since someone move over other? comparison footnote why? only matter taste?



#include <iostream>

using namespace std;

void amp_swap(int &x, int &y)
{
int temp = x;
x = y;
y = temp;
}

void star_swap(int *x, int *y)
{
int temp = *x;
*x = *y;
*y = temp;
}

int main()
{
int = 10, b = 20;
cout << "using amp_swap(): " << endl;
amp_swap(a, b);
cout << "a = " << << ", b = " << b << endl;
cout << "using star_swap(): " << endl;
star_swap(&a, &b);
cout << "a = " << << ", b = " << b << endl;
relapse 0;
}


thanks your time!






see also





Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members