ここでは、底と指数に関して混乱があります。2^4と4^2の両方が16に等しいため、これはすぐにはわかりません。
void powQuestion()
{
double a, b, c;
a = 4.0;
b = 2.0;
c = pow(b, a);
printf("%g ^ %g = %g\n", a,b,c); // Output: 4 ^ 2 = 16
a = 9.0;
b = 2.0;
c = pow(b, a);
printf("%g ^ %g = %g\n", a,b,c); // Output: 9 ^ 2 = 512 >> Wrong result; 512 should be 81 <<
// K & R, Second Edition, Fifty Second Printing, p 251: pow(x,y) x to the y
double x, y, p;
x = 9.0;
y = 2.0;
p = pow(x, y);
printf("%g ^ %g = %g\n", x, y, p); // Output: 9 ^ 2 = 81
// even more explicitly
double base, exponent, power;
base = 9.0;
exponent = 2.0;
power = pow(base, exponent);
printf("%g ^ %g = %g\n", base, exponent, power); // Output: 9 ^ 2 = 81
}