Contents
Roadmap info from roadmap website
Arrays
In Go an array
is a collection of elements of the same type with a fixed size defined when the array is created.
- @official@Go Arrays
- @official@Effective Go: Arrays
- @video@Learn Go Programming - Arrays (by freeCodeCamp on YouTube)
There are major differences between the ways arrays work in Go and C. In Go,
- Arrays are values. Assigning one array to another copies all the elements.
- In particular, if you pass an array to a function, it will receive a copy of the array, not a pointer to it.
-
The size of an array is part of its type. The types
[10]int
and[20]int
are distinct.