#include /* Example program provided by Dr. Christie Ezeife */ /* The simple program finds the sum of any two given integer numbers using one function with call-by-reference parameters for all function results but call-by-value parameters for all function actual input values. */ /* I declare the function prototype here */ void FindSum(int, int, int *); int main(void) { int Num1, Num2, Sum; printf("Type the two numbers to add: e.g. 45 20 \t:"); scanf("%d %d", &Num1, &Num2); /* Here, I should call the function FindSum to get the Sum */ /* Note the function passes the address of Sum through call-by-reference and this permits the function to access Sum to change the result value. The actual parameters of the FindSum are Num1, Num2, &Sum */ FindSum(Num1, Num2, &Sum); printf("%d + %d = %d \n", Num1, Num2, Sum); return 0; } /* end of Main */ /* Now, I should define the function FindSum specifying its */ /* formal parameters, which are integers N1, N2, int *Sump */ void FindSum(int N1, int N2, int *Sump) { /* For pointer variable used to store an address, we can access content at this address to change its value using * indirection operator as seen below. */ *Sump = N1 + N2; } /* end of function definition for FindSum */