go-arrays


tags:

  • ready
  • online
  • reviewed
  • go
  • summary
  • informatic
  • data-structure

arrays

Contents

__Roadmap info from [ roadmap website ] (https://roadmap.sh/golang/go-basics/arrays) __

Arrays

In Go an array is a collection of elements of the same type with a fixed size defined when the array is created.

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.