Suppose, I have an array
array1 := [5]int {
1,2,3,4,5,
}
And I need to increase this array size.
- How can I increase array size in
go
so that I can add additional element?
If I have another array
array2 := [5]int {
6,7,8,9,10,
}
- How can I append
array2
witharray1
?
Then array1
will print [1,10]
for i:=0; i<len(array1); i++ {
fmt.Print(array1[i], "," )
}
Output:
1,2,3,4,5,6,7,8,9,10