This is a creation in Article, where the information may have evolved or changed.
Email: hahayacoder@gmail.com
The operation of the array in the Go language is relatively simple, and the C language is very similar, good, nonsense not much to say, directly on the code, I believe that all can understand
Package Mainimport "FMT" Func Main () {//declares an array var number [5]intfmt] that contains 5 int types. PRINTLN ("Array number:", number) FMT. PRINTLN ("Array len:", Len (number))//sets the value of the variable within the array number[1] = 1number[3] = 3fmt. PRINTLN ("Array number:", number)//defines an array in another way num: = [5]int{0, 1, 2, 3, 4}fmt. PRINTLN ("Array num:", num)///two-dimensional array var array2d [2][3]intfor I: = 0; I < 2; i++ {for J: = 0; J < 3; J + + {Array2d[i][j] = i + j}}fmt. Println ("Array2D:", array2d)//array of slicing operations a: = [5]int{0, 1, 2, 3, 4}//a[2], a[3] does not include a[4]b: = A[2:4]fmt. Println ("B:", B)//from a[0] to A[4] does not include a[4]c: = A[:4]fmt. Println ("C:", c)//from a[2] to A[4] includes a[2]d: = A[2:]fmt. Println ("D:", D)}