Hi,
i hope someone can help me... i coded the this function:
Code:
#include <stdio.h>
#include <math.h>
struct parabel {
double a;
double b;
double c;
};
int scheitelhoehe(struct parabel p, double *y) {
int tmp;
int a1 = 0, b1 = 0, c1 = 0;
a1 = 1;
b1 = 2;
c1 = 3;
tmp = 0;
if (a1 != 0)
{
tmp = -(b1 / (2 * a1));
*y = a1*pow(tmp, 2) + (b1*tmp) + c1;
return 0;
}
else
{
return 1;
}
}
int main() {
struct parabel p[] = {
{ 1, 2, 3 },
};
double y = 0;
scheitelhoehe(p[0], &y);
printf("y = %d\n", y);
}
can somebody tell me why the output is 'y = 0' and not 'y = 2'?
thank you sooooo much!
kongkong