Labelling arrays

I have a code with lots of arrays. Ideally I'd want to call these something like array1, array2, array3, etc, so that I can have loops like

for i from 1 to N
arrayi[some element] = something
end

I'm currently doing this by having a single two dimensional array, such that what I want to call array1[some element] is array[1][some element], and so my loop is

for i from 1 to N
array[i][some element] = something
end

but N is so big, and I need so many elements per array, that my code gives a segmentation fault under the weight of it all. How can I avoid this. Is there some way to label the arrays such that they can all remain separate, and I can call them in a loop as I would like?
If your array is too big, you should be getting a stack overflow error. To solve it you would make your array dynamic. Though if you're getting a segfault, it might be due to something else. I'm not sure.
Topic archived. No new replies allowed.