I'm working in Code::Blocks on a project in C.
When I compile I get the error: "incompatible types when assigning to type 'double *' from type 'double'" on lines 81, 85, 90, 91.
The project is to take a unit conversion tool and incorporate multiple functions instead of everything under the main().
Try dereferencing the pointer:
All of the errors you're getting are variations on a theme. Take this line, for example:
Here,
pKelvin
has typedouble*
, meaning that it's a pointer to an object of typedouble
. On the other hand, the right-hand side has typedouble
, meaning that it's an actualdouble
. C is complaining because you can't assigndouble
s todouble*
s, since they represent fundamentally different types.To fix this, you probably want to write
This says "store the value of
PROD((fahrenheit+459.67),ytemp)
at thedouble
pointed at bypKelvin
. This works because you're now assigning adouble
to an object of typedouble
.More generally, if you ever see an error like this one, it probably means you're assigning a pointer to a non-pointer or vice-versa.
Hope this helps!