I try to learn using pointers in functions by "simply" counting a circle. i get the error expected expression before '=' token
but cant understand why. saying expected expression before.. is unclear to me, what kind of?
#define PI = 3.1415f
void circle(float *wert) {
*wert = ( (*wert) * (*wert) * PI );
}
int main(void) {
float radius;
printf("radius input: ");
scanf("%f", &radius);
circle(&radius);
printf("the circle size will be: %f", &radius);
}
#define PI = 3.1415f
should be
#define PI 3.1415f
The macro PI is replaced when used in the code by 3.1415
#define PI = 3.1415f
There should be no =
here. Change into
#define PI (3.1415f)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With