Complete the code to declare an array of 5 integers.
var numbers [[1]]intThe number inside the square brackets specifies the fixed size of the array. Here, 5 means the array can hold exactly 5 integers.
Complete the code to access the third element of the array named 'data'.
value := data[[1]]Array indices in Go start at 0, so the third element is at index 2.
Fix the error in the code to declare an array with a variable size 'n'.
var arr [[1]]int // n is a variable n := 10
Array sizes in Go must be constants known at compile time. Using a variable like 'n' is not allowed. Use a constant or literal instead.
Fill both blanks to create a fixed-size array and assign a value to its first element.
var arr [[1]]int arr[[2]] = 100
The array size must be a constant (5 here). The first element index is 0.
Fill all three blanks to declare an array, assign a value, and print the length.
var arr [[1]]int arr[[2]] = 42 fmt.Println(len(arr) == [3])
The array size is 5, the first element index is 0, and the length of the array is 5.