# How large is the array size ?

• ### Question

• Just quick question...

I love game design and game programing.

Wednesday, May 30, 2012 4:44 PM

• Assuming you mean System.Array, ie. any normally defined array (int[], etc). This is the maximum number of values the array can hold. The size of each value is only limited by the amount of memory or virtual memory available to hold them.

This limit is enforced because System.Array uses an Int32 as it's indexer, hence only valid values for an Int32 can be used. On top of this, only positive values (ie, >= 0) may be used. This means the absolute maximum upper bound on the size of an array is the absolute maximum upper bound on values for an Int32, which is available in Int32.MaxValue and is equivalent to 2^31, or roughly 2 billion.

With Thanks and Regards
Sambath Raj.C ;
click "Proposed As Answer by" if this post solves your problem or "Vote As Helpful" if a post has been useful to you

• Marked as answer by Thursday, May 31, 2012 6:24 AM
Thursday, May 31, 2012 2:29 AM

### All replies

• Siz = Array.GetItemCount(arr)
• Proposed as answer by Wednesday, May 30, 2012 5:55 PM
• Unproposed as answer by Wednesday, May 30, 2012 6:27 PM
Wednesday, May 30, 2012 5:53 PM
• I meant what is the maximum amount of an array when you create it ?

I love game design and game programing.

Wednesday, May 30, 2012 6:18 PM
• Assuming you mean System.Array, ie. any normally defined array (int[], etc). This is the maximum number of values the array can hold. The size of each value is only limited by the amount of memory or virtual memory available to hold them.

This limit is enforced because System.Array uses an Int32 as it's indexer, hence only valid values for an Int32 can be used. On top of this, only positive values (ie, >= 0) may be used. This means the absolute maximum upper bound on the size of an array is the absolute maximum upper bound on values for an Int32, which is available in Int32.MaxValue and is equivalent to 2^31, or roughly 2 billion.

With Thanks and Regards
Sambath Raj.C ;
click "Proposed As Answer by" if this post solves your problem or "Vote As Helpful" if a post has been useful to you

• Marked as answer by Thursday, May 31, 2012 6:24 AM
Thursday, May 31, 2012 2:29 AM
• I don't think there's anything like System.Array in SB. At least, not one we can directly access from the programming language itself.  :D
Thursday, May 31, 2012 2:47 AM
• Hello Primoz128!

In your previous thread -> the for loop..., I've left an enhanced example version for your For...EndFor loops, along w/ alternative array creation and also how to count backwards using the Stack object.

Gonna repeat the code here for convenience:

```bullet[1] = "1=10;2=11;3=12;4=13;5=14;"
bullet[2] = "1=15;2=16;3=17;4=18;5=19;"

For i = 1 To Array.GetItemCount( bullet )
For j = 1 To Array.GetItemCount( bullet[i] )
store = bullet[i][j]
TextWindow.WriteLine(store)
Stack.PushValue("Storage"  store)
EndFor
EndFor

While Stack.GetCount("Storage") > 0
TextWindow.WriteLine( Stack.PopValue("Storage") )
EndWhile```

As you can see, SB's arrays are nothing more than an über long string!

It follows this following model for uni-dimensional ones:
"index1=value1;index2=value2;index3=value3;" and so on...

I've read from many SB forum posters here that if an array has many elements, and especially many dimensions, it will surely get very slowly!

SB is very flexible to grow or remove elements from an array on the get-go!

Hope this explanation was useful to ya!  :P

Thursday, May 31, 2012 3:01 AM