I'm teaching my C with K&R this book, and got confused by the power function from 1.7 example.
Well, when I wrote the code exactly from the example given by the book on Code::Block and ran it, an error occurred: undefined reference to 'power'.
The codes are as follow:
#include <stdio.h>
#include <stdlib.h>
int power(int m, int n);
main ()
{
int i;
for (i = 0; i < 10; ++i)
printf("%d %d %d\n", i, power(2, i), power(-3, i));
return 0;
}
Is power function a predefined function provided by library? Because program above didn't define the body part of power
If so, why did I run into error? Did I include the wrong library?