Any Smart guy can figure this out? Should be simple problem.
I am getting this error when want to compile.
Code:
/tmp/ccmvPe9e.o: In function `stdData':
problem.c:(.text+0x56b): undefined reference to `sqrt'
collect2: ld returned 1 exit status
And this is the "StdDate" below. Where is the problem? sqrt???
Code:
double stdData (double x[], int n)/* function to find the standard deviation */
{
int i;
double sum = 0, sum1 = 0;
double sum2, std;
for (i=0; i<n; i++){
sum1 = sum1 + (x[i]*x[i]);
sum = sum + x[i];
}
sum2 = (sum * sum)/(n*n);
std = sqrt(sum1- sum2);
return (std);
}