Programming: Declaring an Array with Initialized Values
Share
When an array is declared, it can also be initialized at the point of declaration. The braces are used to initialize each array value:
type variable[array dimension] {values]; Example: int myArray[4] {4, 65, 2, 34}; This sets the array like so: myArray[0] = 4; myArray[1] = 65; myArray[2] = 2; myArray[3] = 34;