
Please Help With C Program
Quote:
> I'm trying to write a program and I keep getting an error saying:
> error C2664: 'avgFun' : cannot convert parameter 1 from 'int *' to 'int'
> This conversion requires a reinterpret_cast, a C-style cast or
> function-style cast
> Here's the code:
> #include <stdio.h>
Check these out, see if they all "agree" or match:
1. The prototype or declaration:
Quote:
> void avgFun(int grd1, int grd2, int grd3, float avg);
[snip]
2. The call or execution of the function:
Quote:
> avgFun(&grd1, &grd2, &grd3, &avg); // call function
[snip]
3. The definition of the function
Quote:
> avgFun(int *grd1, int *grd2, int *grd3, float *avg)
> {
> *avg = (*grd1+*grd2+*grd3) / 3;
> return(0);
> }
If you haven't seen it already, the prototype is different than the call and
definition of the function. The prototype declares the arguments as integers;
the others use pointers to integers.
That wasn't difficult.
--
Thomas Matthews