Hello,
I am a rookie and I have written a simple code to multiply a number raised to the power value. When I compile the program I get the below mentioned error. If I change the function name then the error vanishes. I think the func "power () " is an inbuilt function hence I cannot use the func "power()". Kindly help me out.
#include<stdio.h>
void power(int n, int p, int *r)
{
int i;
*r = 1;
for(i=1;i<=p;i++)
{
*r *= n;
}
}
int main(void)
{
int num,power,result;
printf("Enter the number\n");
scanf("%d",&num);
printf("Enter the power\n");
scanf("%d",&power);
power(num, power, &result);
printf("Result:%d\n",result);
return 0;
}
Building Ex_D.obj.
C:\Users\KHT\Documents\Pelles C Projects\Chp5\Ex_D.c(30): error #2068: Expected called object to have function type, but found 'int'.
*** Error code: 1 ***
Done.