When I add this function in my program, I get this error: "Segmentation fault". I have found that it is probably connected with pointers.
This is my function:
void deBoor(double* D, double* t, double x, int k, int n, double* R){ int i,j,l; double ret[3]; double* P=(double*)malloc(n*sizeof(double)); for(i=0; i<n; ++i) P[i]=D[i]; j=k; while(x<t[j]) ++j; while(x>=t[j+1]) ++j; for(l=1; l<=k; ++l){ for(i=j; i>=j-k+l; --i) { P[i]=(x-t[i])/(t[i+k+1-l]-t[i])*P[i]+(t[i+k+1-l]-x)/(t[i+k+1-l]-t[i])*P[i-1]; } } R[0]=P[j]; free(P);}
And this is the call of the function:
deBoor (kontrolne_tocke, prosirena_particija, xx, k, duljina, R);