Previous:Declaring Arrays Main Index Next:Language Directives
Because it is cumbersome to individually initialize the elements of an array, you may initialize it as it is created using array initializer syntax. For example:
#include "colors.inc" #declare FlagColors = array[3] {Red,White,Blue}
Multi-dimensional arrays may also be initialized this way. For example:
#declare Digits = array[4][10] { {7,6,7,0,2,1,6,5,5,0}, {1,2,3,4,5,6,7,8,9,0}, {0,9,8,7,6,5,4,3,2,1}, {1,1,2,2,3,3,4,4,5,5} }
The commas are required between elements and between dimensions as shown in the example.
Previous:Declaring Arrays Main Index Next:Language Directives