-
Big 2D array
I asked this question in the C board but I was wondering if this could work in C++.
The C board said I might be pooched. (my program is actually in c++ but mostly written in C... it wasnt my choice). Sorry for posting 2 times. I also suppose my declaration would be different, but is this possible to do?
************************************************** *
I need to make a 1x128,000,000 element array (it looks like)
Code:
[1]
[2]
[3]
[4]
...
[128000000]
but i cant seem to declare 128,000,000 elements my C program seems to crash As soon as I try. Not my computer just the c++ program
Here is the declaring line of code (i dont have code for this array any where else yet.)
Code:
int TransposeData[1][128];
I do get this error when I compile but i ignored it
Code:
C:\...cpp(256) : warning C4101: 'TransposeData' : unreferenced local variable
can i use an array this big?
-
Asking the question more than once is stupid, and a violation of the rules.
As I said before, if you need that much memory for a simple project, you've probably messed up on the project design.
-
I agree with MacGyver on both accounts.
But to answer the specific question: No there's no real difference between large arrays in C or C++. I also gave some comments in the other thread, and these also apply here.
Now that's cleared up, maybe some moderator can lock this thread.
--
Mats
-
sorry
i didnt know it would be that similar.
i tried to use malloc it works ok with a 128,000,000x1 array
but im not sure how to do a 2D array with malloc
here is the code i used to make a 128000000x1 array (i'm not actually using int that was just for testing)
Code:
Data[0] = (U16 *) malloc(( NumberofElements)*sizeof(U16));
im trying to find malloc for 2D array on google.
-