上QQ阅读APP看书,第一时间看更新
Array
Arrays are made up of sequenced elements of a specific type. An array can be created for any data type. The length of an array cannot be changed and must be specified at the time of declaration. Arrays are seldom used directly, but are used mostly through the slice type covered in the next section. Arrays are always one-dimensional, but you can create an array of arrays to create multidimensional objects.
To create an array of 128 bytes, this syntax can be used:
var myByteArray [128]byte
Individual elements of an array can be accessed by its 0-based numeric index. For example, to get the fifth element from the byte array, the syntax is as follows:
singleByte := myByteArray[4]