My GCC compiler giving me warning: power.c: In function ‘main’: power.c:9:36: warning: implicit declaration of function ‘power’ [-Wimplicit-function-declaration] 9 | printf("%d \t %d \t %d \n", i+1, power(2,i), power(-6,i)); |
whereas I have clearly declared implicit for the power function, which I give in the following code
#include <stdio.h>
int main(){
int i;
printf("%s \t %s \t %s \n", "Powers", "of 2", "of -6");
for (i = 0; i < 10; ++i)
printf("%d \t %d \t %d \n", i+1, power(2,i), power(-6,i));
return 0;
}
int power(int base, int n){
int i, p;
p = 1;
for (i=0; i <= n; ++i)
p = p * base;
return p;
}