Call by reference
void swap(int &x, int &y)
{
int temp = x;
x = y;
y = temp;
cout<<x<<”\\”<<y<<endl;
}
int main()
{
int main x = 6;
swap(m,n);
return 0;
}
Return by Reference
int val[5] = {1,2,3,4,5};
int &display(int i)
{
return val[i];
}
int main()
{
cout << display(i) <<endl;
return 0;
}