Call by Value and Call by Reference in C++

In C++, Call by Reference permits us to pass parameters to the function by reference. When we pass the arguments by reference, the formal arguments in the called function becomes aliases to the actual arguments in the calling function that means when the function is working with its own arguments.

void swap(int *a, int *b)
{
 int n;
n=*a;           // assign the value at the address a to n //
*a=*b;
*b=n;
}
swap(&x, &y);   // call by passing //