Why does the following bit of code work in C:
int res = pow(2, 3);
printf("%d
", res);
while this other doesn't?
int a = 2;
int b = 3;
int res = pow(a, b);
printf("%d
", res);
Even if I try
double a = 2;
double b = 3;
double res = pow(a, b);
printf("%f
", res);
I get an
undefined reference to `pow'
What am I doing wrong?
question from:https://stackoverflow.com/questions/4174080/using-pow-function-throws-undefined-reference-error-in-c