|
-
February 24th, 2006, 11:20 AM
#1
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
-
February 24th, 2006, 11:37 AM
#2
Re: Large matricies
Allocate memory on the heap instead:
Code:
int * matrix = new int[1024*1024];
-
February 24th, 2006, 12:27 PM
#3
Re: Large matricies
Or even better: use std::vector instead.
-
February 24th, 2006, 12:29 PM
#4
Re: Large matricies
Or use global array. Or use vector (as a way of/instead of manually allocating memory).
"Programs must be written for people to read, and only incidentally for machines to execute."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|