My code looks like
#include <stdio.h>
#include <math.h>
int main (void)
{
float x1, x2, x3;
float y1, y2, y3;
float Cos0, i, j, k, innerProduct;
float Xlength, Ylength;
x1=0;
x2=0;
x3=0;
y1=0;
y2=0;
y3=0;
Cos0=0;
i=0;
j=0;
k=0;
innerProduct=0;
Xlength=0;
Ylength=0;
printf("Please insert six floating point numbers \n");
scanf("%f%f%f%f%f%f", x1, x2, x3, y1, y2, y3);
Xlength=sqrt((x1*x1)+(x2*x2)+(x3*x3));
Ylength=sqrt((y1*y1)+(y2*y2)+(y3*y3));
i=x1+y1;
j=x2+y2;
k=x3+y3;
innerProduct=((x1*y1)*(x2*y2)*(x3*y3));
Cos0=(innerProduct)/((Xlength*Ylength));
return 0;
}
And I get the following compile errors "warning: format %f expects argument of type 'float *' but argument "x" has type double"
where x is one of the digits, this happens for all 6 arguments in the scanf command, I have specified all of the variables as floats, and it doesn't like that.
How do I fix this? Thanks!