I want to check result with geo_analyzer function using by check_line and check_triangle. Thank you for appreciated answers. I don't know why I get the error. Besides I compile on ubuntu I get error here
if(check_line==1)
return 1; // line
if(check_triangle==1)
return 2; //triangle
code of the function in function
double calculateSlop(double a,double b,double c,double d){
return (d-c)/(b-a); // like (y2-y1)/(x2-x1)
}
int geo_analyzer( double p1_x, double p1_y, double p2_x, double
p2_y, double p3_x, double p3_y, double p4_x, double p4_y){
double m1,m2,m3;
m1=calculateSlop(p1_x,p2_x,p1_y,p2_y);
m2=calculateSlop(p2_x,p3_x,p2_y,p3_y);
m3=calculateSlop(p3_x,p4_x,p3_y,p4_y);
if(check_line==1){
return 1; // line
}
if(check_triangle==1){
return 2; //triangle
}
}
You are comparing a function pointer with an integer. If you need the output of the function, call it by check_line(arg1, arg2, arg3, ...)
.
Are check_line and check_triangle functions or variables?
When you write if(check_line==1)
and if(check_triangle==1)
you are actually saying that there are variables called "check_line" and "check_triangle" and you want to know if they are equal to the integer 1.
If you want to check if the OUTPUT of the functions "check_line" and "check_triangle" are equal to integer 1, then what you want do is verify what arguments you want to pass to these functions and write if ( check_line(argument1, argument2, ...)==1 )
and so on.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.