Functions that use input and output parameters can be called multiple times with
different arguments. Each call operates on the data provided by the calling
function and returns results through the output parameters.

This capability allows the same function to be reused throughout a program,
reducing code duplication and improving maintainability. Proper use of pointers
ensures that each function call correctly updates the corresponding variables in
the calling environment.
EXAMPLE:

#include <stdio.h>

void addtins(int *p,int tin){
    *p = *p +tin;
}
int main() {
    int factory1=100;
    int factory2=200;
    
    addtins(&factory1,150);
    addtins(&factory2,-50);
   
    printf("After Function F1: %d\n",factory1);
    printf("After Function F2: %d",factory2);
    return 0;
}
Previous Next