Pass by Reference
      In order to modify the actual elements value we need to pass the address of the variable and then address is accepted in a pointer in the function.
/*
	http://www.ProbCOMP.com
	
	When we pass by value we do not make any changes to the actual element being passed. In order to modify the actual elements value we need to 
	pass the address of the variable and then address is accepted in a pointer in the function.
*/

#include<stdio.h>

void swap(int *a,int *b) // whenever address is passed we use pointers
{
	int tmp;
	tmp=*a;
	*a=*b;
	*b=tmp;
	

}

void main()
{
	int a=10,b=20;
	swap(&a,&b);
	printf("a=%d and b=%d",a,b);
}

									

Download Program
Did You Know ?
IP address is a numerical label that is assigned to devices participating in a computer network. Read More