C lang. -- Error: Segmentaion fault
Posted
by user233542
on Stack Overflow
See other posts from Stack Overflow
or by user233542
Published on 2010-05-02T22:04:12Z
Indexed on
2010/05/02
22:07 UTC
Read the original article
Hit count: 289
segmentation-fault
|c
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
© Stack Overflow or respective owner