In Go, array has to have its length declared at the time of declaration, limiting its users where length can not be determined. For example responses from third party api's etc. Array in Go can be declared with [n]T where n is length of array and T would be type of elements its going to hold.
So we do see that we declared an integer array of size 3, since we did not specify elements, Go has initialized it with zeros of int, that are 0
Go allows one to assign values to an array by its index, for example to assign value 6 to array declared in previous example at index 2, one would write
In Go, we can also initialize an array at the time of declaration with default values. See following example
declared:=[5]int{1,2,3,4,5}
In this, declared variable contains an array of lenth 5, holding values from one to five, in that order. Go also enables programmers to have two dimentional array, like following