pow doesn't accept the second parameter to be a variable on gcc
- by Daziplqa
pow doesn't accept the second parameter to be a variable on gcc
The following code works fine on VC++10
// file test.cc
#include "stdafx.h"
#include <stdio.h>
#include <math.h>
int main(void)
{
double x = 10;
int y = 20;
printf("%f\n", pow(x, y));
return 0;
}
But the following code doesn't not work on gcc:
// test.c
#include <stdio.h>
#include <math.h>
int main(void)
{
double x = 10;
int y = 20;
printf("%f\n", pow(x, y)); // error here, says no such function, however when pass the second argument in `pow` for the code runs by gcc, It works fine!
return 0;
}