Jump to content
  • Advertisement
Sign in to follow this  
back2newbelf

dimension of array

This topic is 4860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

int array[26]; // makes an array with 26 elements
array[0] = some_integer; // writes to the first element

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]??

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!