Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Difference between call by value and call by reference in C

Difference between call by value and call by reference:
Call by value pass actual parameter but, call by reference will pass the address reference which allow to access/modify value on a particular address location.


Example : Call by value
void callbyvalue(int a, int b)
{
   int temp;
 
   temp = b;
   b = a;
   a = temp;   
}
 



Example : Call by refernece

void callbyreference(int *a, int *b)
{
   int temp;
 
   temp = *b;
   *b = *a;
   *a = temp;   
}