C/C++ Programming

Status
Not open for further replies.

pacificboy

Broken In
Related to pow() function in C/C++. The Syntax is : pow(x,y). If the y part of the function is a fraction it gives an error. What should be the Syntax for such a function that there is no error?
 

QwertyManiac

Commander in Chief
Pow(x,y) has always worked perfectly for me with fractional y.

Does this program give you an error? Doesn't for me.

Code:
#include<math.h>
#include<stdio.h>

int main(void)
{
    (void)printf("%f\n",pow(4,0.75));
    return 0;
}

Note: If using GCC to compile, do link the math.h by passing -lm parameter.
 
K

khattam_

Guest
The return is double.. so make sure you use double for the variable...
 
Status
Not open for further replies.
Top Bottom