Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Scavenger on Wed 15/10/2003 22:00:52

Title: 2D Arrays (solved)
Post by: Scavenger on Wed 15/10/2003 22:00:52
I was just wanted to know, how is it again you create 3D arrays like:
character[CHARID].inv
Title: Re:3D arrays? Someone enlighten me.
Post by: Pumaman on Wed 15/10/2003 22:37:41
That's not a 3D array, that's just one array inside another (which is in a way, a 2D array).

You can do:

struct Test {
 int elements[10];
};

Test array[10];


then:

array[4].elements[2]   or whatever.

Make sure you don't exceed the array bounds, no checking is done.
Title: Re:2D Arrays (solved)
Post by: Scavenger on Wed 15/10/2003 22:40:09
Thankye Pumaman! Whatever will we do without you?Most probably perish... or be eaten by some subterrean wildebeest. Long live CJ!
Title: Re:2D Arrays (solved)
Post by: Pumaman on Wed 15/10/2003 22:42:52
Hehe ;)

For reference, this is not documented in the manual because arrays are not safe (you can declare one with 10 elements, then access element 25, which may crash the game or cause strange random results).