When a function with output parameters is called, the actual arguments supplied
must be addresses of variables. These addresses are passed to the formal
parameters, which are pointer variables in the function definition.

Through this mechanism, the function can directly modify the variables in the
calling function. This technique is widely used in C to simulate returning
multiple values from a function and to improve program efficiency.
SYNTAX:

void function(type *param)
{
 *param = value;
}
EXAMPLE:

#include <stdio.h>

void addtins(int *p){
    *p=100;
}
int main() {
    int tins=0;
    addtins(&tins);
    printf("Updated Tins : %d",tins);
}
Previous Next