Question on large arrays in C

bs at linus.UUCP bs at linus.UUCP
Fri Feb 13 23:33:21 AEST 1987


In article <1051 at uwmacc.UUCP>, jwp at uwmacc.UUCP (Jeffrey W Percival) writes:
> #include <stdio.h>
> #define N 20480
> main()
> {
> 	double x[N];
> 	double y_1[N];
> 	double y_4[N];
 
etc.
> When I run it, I get "Segmentation violation".
 
Try typing 'limit' to UNIX. It will tell you what your current
program size and stack size limits are. I suspect, that since your
variables are local, and hence placed on the stack, that you have
overflowed the stack size limit.

One can set stacksize limits via:

% limit stacksize  amount

where amount is how much space you want

Bob Silverman



More information about the Comp.lang.c mailing list