I need to modify the following function to compare with the library power using power (double, double)

#include "stdafx.h"
#include "stdio.h"
double mypower(float a, int n); // function prototype//
int main (void)
    float a;
    int n;
	int power;

    printf("\n enter a value of a\n");
	scanf ("%d", &a);
	printf("\n enter value of n\n");
	scanf ("%d", &n);
	power= mypower (a,n);
    printf("The result is %d\n", power);
	 return 0;
double mypower(float a, int n)
if (a==0.0) 
        return 0.0;
    else if(n==0)
        return 1.0;
    else if (n>0)
        return( a* mypower(a,n-1));
        return (1.0/ mypower(a,-n)); 

My error is showing that
(23) : error C2064: term does not evaluate to a function taking 2 arguments. Do I have to include the power library in the function?

9 Years
Discussion Span
Last Post by Aia

scanf ("%d", &a); What type is variable a?

substitute syntax for C in this forum.

add the (/) to the closing bracket.

#include "stdio.h" will make the compiler to look for the file stdio.h in the current directory first and then in the path that the compiler have been set to look for standard libraries.
Substituting for <stdio.h> will make to look directly where it needs to look for.

You don't need to #include "stdafx.h". Nothing that you are doing requires that header file.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.