Re: segmentation fault-- is my array too long?

2004-05-08 Thread Henrik W Lund
Malcolm Kay wrote: On Friday 07 May 2004 06:42, Henrik W Lund wrote: malloc() is your friend! :-) -- double *ncost = malloc(sizeof (double) * persons * scens); -- This ought to do the trick. Just remember to make sure that malloc returns a valid pointer, otherwise you'll have another seg

Re: segmentation fault-- is my array too long?

2004-05-07 Thread Malcolm Kay
On Friday 07 May 2004 06:42, Henrik W Lund wrote: malloc() is your friend! :-) -- double *ncost = malloc(sizeof (double) * persons * scens); -- This ought to do the trick. Just remember to make sure that malloc returns a valid pointer, otherwise you'll have another seg fault. I'm

segmentation fault-- is my array too long?

2004-05-06 Thread Caroline Korves
Hello, This short program below represents a problem I am having with segmentation faults in a much larger C program that has numerous arrays. Seems as though when I increase the number of elements in an array (here, for example, beyond 130,000) a seg fault occurs. Any idea

Re: segmentation fault-- is my array too long?

2004-05-06 Thread Charles Swiger
This doesn't have much to do with FreeBSD, but... On May 6, 2004, at 2:58 PM, Caroline Korves wrote: Any idea on what I should change to make the program run with large numbers of elements in my arrays? Automatic variables get allocated from the stack, which can only grow to handle 8 MB or so by

Re: segmentation fault-- is my array too long?

2004-05-06 Thread Henrik W Lund
Subject: segmentation fault-- is my array too long? From: Caroline Korves [EMAIL PROTECTED] Date: Thu, 06 May 2004 14:58:43 -0400 To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Hello, This short program below represents

Re: segmentation fault-- is my array too long?

2004-05-06 Thread Henrik W Lund
Subject: segmentation fault-- is my array too long? From: Caroline Korves [EMAIL PROTECTED] Date: Thu, 06 May 2004 14:58:43 -0400 To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Hello, This short program below represents