C lang. -- Error: Segmentaion fault
- by user233542
I don't understand why this would give me a seg fault. Any ideas?
this is the function that returns the signal to stop the program:
(below is the other function that is called within this)
double bisect(double A0,double A1,double Sol[N],double tol,double c)
{
double Amid,shot;
while (A1-A0 tol) {
Amid = 0.5*(A0+A1);
shot = shoot(Sol, Amid, c);
if (shot==2.*Pi) {
return Amid;
}
if (shot > 2.*Pi){
A1 = Amid;
}
else if (shot < 2.*Pi){
A0 = Amid;
}
}
return 0.5*(A1+A0);
}
double shoot(double Sol[N],double A,double c)
{
int i,j;
/Initial Conditions/
for (i=0;i
for (i=buff+2;i
return Sol[i-1];
}
buff, l, N are defined using a #deine statement. l = 401, buff = 50, N = 2000
Thanks