dimension of array

Started by
14 comments, last by T2k 18 years, 9 months ago
hi yesterday i discovered that the max dimension of an array is 25. after that i get some weird linking error(i'm using c++ with M$VS 6) warning LNK4084: total image size -2146963456 exceeds max (268435456); image may not run (compiling went fine though) now i'm in search for a similar datatype with less restrictions
Advertisement
That sounds weird... could you post your code?
the line that produces the error is:
array[2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2]
these are 26 2's, if i remove one it works fine
Er, have you considered how much storage space is in use there? That's probably the problem - 2^26 times the size of whatever it is you're storing o_O

What exactly are you trying to do?
i'm trying to write a statistics program for the nba(national basketball assocation)
an easy example what the array does:
let's say a team has 10 players, only 5 of them can be on the court an once. if player1 is oncourt i give a variable called player1oncourt a '1', if he's offcourt it gets a '0'
the array then looks like this
array[player1oncourt][player2oncourt]..[player10oncourt] where 5 playerXoncourt are '1', 5 are '0'
whenever something happens to the game i add sth to the array
array[player1oncourt][player2oncourt]..[player10oncourt]
which *knows* who's oncourt and who's not
multidimensional arrays are represented internally as normal arrays...

So.. You maybe getting to a size larger than max int... Let's say that internally a 32bit integer is the data type of array subscripts.. Thus, you can't have an array of a size larger than 2 ^ 32 = 4294967296...
Quote:Original post by back2newbelf
i'm trying to write a statistics program for the nba(national basketball assocation)
an easy example what the array does:
let's say a team has 10 players, only 5 of them can be on the court an once. if player1 is oncourt i give a variable called player1oncourt a '1', if he's offcourt it gets a '0'
the array then looks like this
array[player1oncourt][player2oncourt]..[player10oncourt] where 5 playerXoncourt are '1', 5 are '0'
whenever something happens to the game i add sth to the array
array[player1oncourt][player2oncourt]..[player10oncourt]
which *knows* who's oncourt and who's not


You've got things the wrong way around for sure. What you want is a single dimension array of 10 items (or however many it does need to be), and to represent whether player N is on or off course, set element N of the array to 0 or 1. The given array represents all the possible subsets of players, not simply all the players.

int array[26];           // makes an array with 26 elementsarray[0] = some_integer; // writes to the first element 
as it is said that loop statements should not go beyond 3 levels,similarly is it that Arrays shuld not go beyond 3-4dimentions.Well I agree thatback2newbelf is doing it the wrong way and he should have only one array of 10.

Got a Game? Get Reviews and Links.Free and Honest Publicity never Hurts!ITnauts.com

i'm not sure you guys really understand what i need.
let's say i want the score for lineup
player1, player3, player5, player7, player9

in my old code this would be
array[1][0][1][0][1][0][1][0][1][0]

how would i do this with array[10]??

This topic is closed to new replies.

Advertisement