DIGIT-ARC read-only archive · snapshot: July 23, 2026

C/C++ Programming

3 posts · originally from https://geek.digit.in/community/threads/c-c-programming.81244/

P
pacificboy Original post #1
Feb 27, 2008 at 9:46 PM
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
Feb 27, 2008 at 10:18 PM
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_ #3
Feb 28, 2008 at 3:43 AM
The return is double.. so make sure you use double for the variable...