# Composed function - segmetnation violation

I am trying to build and draw a composed function with a very simple code, but when I run the macro i obtain a segmentation violation error which I cannot understand. I don’t know if I am doing something
wrong but I cannot see it.
This is my code:

``````double FD(double *x, double *p){
double t0, A,B,C;
t0=p[0];
A=p[1];
B=p[2];

double result = A/( 1+exp( -(x[0]-t0)/B ) );
return result;
}

double FDL(double *x, double *p){
double t, t0, A,B,C, sigma;
t0   = p[0];
A    = p[1];
B    = p[2];
sigma= p[3];
t    = x[0];
double result;
double *FDpars;
double *FDx;
//TF1 *F = new TF1("fermidirac",FD,0,512,3);
if(t<t0){
FDpars[0]=t0,
FDpars[1]=A;
FDpars[2]=B;
FDx[0]=t0;
result=FD(FDx,FDpars);
}else if(t>t0){
result=TMath::Landau(t,t0,sigma);
}

return result;
}

void DrawFDL(){
TF1 *fermidiraclandau = new TF1("fdl",FDL,0,512,4);
fermidiraclandau->SetParameter(0,330);
fermidiraclandau->SetParameter(1,1);
fermidiraclandau->SetParameter(2,1);
fermidiraclandau->SetParameter(3,1);
fermidiraclandau->Draw();
return;
}
``````
``````        double FDpars[3];
double FDx[1];
``````

That actually worked. Thanks