Question

Consider the following C code snippet for calculating base raised to the power of exp:     #include     double power(double base, int exp) {         if (exp == 0) {             return 1;         }         // Missing handling for negative exponent         return base * power(base, exp - 1);     }     int main() {         printf("%.2f\n", power(2.0, -2));         return 0;     }     What will be the output or behavior of the program when power(2.0, -2) is called?

A 0.25
B 4.00
C 0.00
D A segmentation fault or stack overflow
E Compilation error
Practice Next

Hey! Ask a query