Call by reference : Function Parameter « Function « C Tutorial






#include<stdio.h>


main ( )
{
    int i;
    i = 0;
    printf (" The value of i before call %d \n", i);
    f1 (&i);
    printf (" The value of i after call %d \n", i);
}
 f1(int *k)
{
    *k = *k + 10;
}
The value of i before call 0
 The value of i after call 10








8.5.Function Parameter
8.5.1.Parameter passing
8.5.2.Call by reference
8.5.3.Pass variables to function
8.5.4.Use pointer as function parameter
8.5.5.Cube a variable using call-by-value
8.5.6.Cube a variable using call-by-reference with a pointer argument