-
Large matricies
Hello.
I need to make a large matrix. somethign of size 1024 by 1024 and i need a couple of them. THe code works fine when i do thsi:
Code:
int matrix[3][1024][1024];
but when i make 3 arrays instead of a 3 dimensional array the program crashes.
ex:
Code:
int matrix[1024][1024];
int matrx[1024][1024];
int matry[1024][1024];
Any ideas how to circomvent this?
Thx
-
Re: Large matricies
Allocate memory on the heap instead:
Code:
int * matrix = new int[1024*1024];
-
Re: Large matricies
Or even better: use std::vector instead.
-
Re: Large matricies
Or use global array. Or use vector (as a way of/instead of manually allocating memory).