Return value though parameter
#include <stdio.h>
#include <stdlib.h>
void mean(int a, int b, int return_val ) {
return_val = (a + b) / 2;
printf("return_val in mean in %d\n",return_val);
}
int main() {
int i, j;
int answer;
i = 7;
j = 9;
mean(i, j, answer);
printf("The mean of %d and %d = %d\n", i, j, answer);
}
Related examples in the same category