Call by reference :
In Call by reference method, the function is called by sending reference (address) of the variable in the function call statement. All the changes are done directly in the memory of passed variable.
In this algorithm, temp is used to store the value at address pointed by x temporarily.
x and y are the address pointers.
- SET temp=*x
- SET *x=*y
- SET *y=temp
C SOURCE CODE:
#include & lt;conio>
void swap(int *x,int *y)
int a, b;
printf("n Enter value of a & b :");
printf("n Initially, n a=%d ,n b=%d ",a,b);
printf(" n After Swapping :n a=%d ,n b=%d ",a,b);