GPC Developer Guides
Const Arrays
const arrays are basically compiler managed lists of data stored in the data section syntax gpc const \<datatype> \<name>\[] { \<values> }; // single dimensional const \<datatype> \<name>\[]\[] = { { \<values for the first "row"> }, { \<values for the second "row"> } }; // two dimensional the difference between a single dimension array and a multi dimensional array is that the single dimension array is basically a single row with related data while a multi dimensional array allows for slightly better structured data of rows an example of when a multi dimensional array is preferred is when setting up values for different guns in a game you can then have each row represent a single gun and the columns within have each value for it there is an important rule to keep in mind when working with multi dimensional arrays each row must contain exactly the same value there is also an importance of choosing an appropriate data type, it will dictate what values you can use within the array, see the below table for more information about the available datatypes, their support, size, and range datatype supports multi dimension arrays size required per value minimum value maximum value int8 yes 8 bits (1 byte) 128 127 uint8 yes 8 bits (1 byte) 0 255 int16 yes 16 bits (2 bytes) 32 768 32 767 uint16 yes 16 bits (2 bytes) 0 65 535 int32 yes 32 bits (4 bytes) 2 147 483 648 2 147 483 647 string no 8 bits per character + 8 (1 byte + 1 byte) n/a n/a n/a n/a accessing data similar to how the data section works, all indexes always begin at 0 within each row, meaning the first value is stored at 0 when you want to access the data within you do so using the below syntax gpc name\[column]; gpc name\[row]\[column]; below you'll see a couple of examples of how this works gpc const int8 single dimension\[] = { 0, 1, 2 }; const uint8 multi dimension\[]\[] = { { 0, 1, 2 }, { 3, 4, 5 } }; int a, b; main { a = single dimension\[1]; // 1 b = multi dimension\[1]\[2]; // 5 }