arrays?

masterZ

New member
Is there a way to store arrays?

I'm not sure about my syntax

//creates an array
int array[] = {1, 2};






Thank you,
 
Kind've. We've got maps. They include the same purpose, but are much more flexible since they can be indexed by items, stats, strings, ints, etc.
 
I'm pretty sure we also have arrays! I remember seeing something about an array type being introduced months back, but I've never done anything with them.

+1 Entirely Unhelpful Point awarded to me!
 
Technically there is an array type also, although it is a special case of maps. Wasn't really thinking of it at the time since I don't use it much. It is defined like this:

int [5] my_array;

That'll produce an array indexed from 0 to 5. It works just like a map, but somewhat faster. The drawback is, as you'd assume, that it is of static size. Or for our thread starter:

int [1, 2] second_array;
 
Arrays work great - and with 65% fewer grumbling "how the heck does this damn data structure work" posts than maps!
 
Back
Top