I have this program that asks you to input numbers, takes the average and prints it out.... its pretty easy if you do by Value but i have to do it using Call by reference....so far i have :
Code:
#include <stdio.h>
void INPUT(int *var1, int *var2, int *var3, int *var4);
void AVERAGE(int var1, int var2, int var3, int var4,float *var5);
void OUTPUT(float *var);
main(){
int x,y,z,v;
float sum, output;
float *psum, *poutput;
psum=∑
poutput=&output;
INPUT(x, y,z,v);
AVERAGE(x, y,z,v,psum);
OUTPUT(poutput);
}
void INPUT(int *var1, int *var2, int *var3, int *var4){
printf("Please enter four integers : ");
scanf("%d%d%d%d", *var1, *var2, *var3, *var4 );
}
void AVERAGE(int var1, int var2, int var3, int var4,float *var5){
*var5=(var1+ var2 + var3 + var4)/4;
}
void OUTPUT(float *var){
printf("Average of the 4 integers is %5.2f \n", *var);
}
i'm not sure what this error is about....
programs\lab5.c:21: warning: passing arg 1 of `INPUT' makes pointer from integer without a cast
programs\lab5.c:21: warning: passing arg 2 of `INPUT' makes pointer from integer without a cast
programs\lab5.c:21: warning: passing arg 3 of `INPUT' makes pointer from integer without a cast
programs\lab5.c:21: warning: passing arg 4 of `INPUT' makes pointer from integer without a cast