0

This program is giving "undefined reference of sqrt" error:

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

int main(){
int/float/double x=8;
int y=sqrt(x);  //error
printf("%d",y);
}

But when I uses constant value 8, as an argument, it works fine.

int main(){
int y=sqrt(8);  // This is working fine.
printf("%d",y);
} 

using command : gcc <filename>.c

melpomene
  • 81,915
  • 7
  • 76
  • 137

0 Answers0