I have read other questions like this but none seemed to work…
My code is:
int flowRateFormula(int pipeDiameter,double velocity)
{
int integer3;
integer3=PI*(1/4)*(pow(pipeDiameter,2))*velocity;
return integer3;
}
And the error is:
flowRate.c: In function ‘flowRateFormula’:
flowRate.c:38:13: error: invalid type argument of unary ‘*’ (have ‘int’)
What to do?
BTW PI IS DEFINED
Most likely you have the line
somewhere, which causes your code to be equivalent to:
and this fails to compile. Replace it with e.g.
Note also that
(1/4)will be evaluated to 0, because integer division returns an integer. you probably want to use1.0/4.0.