The slice type is an abstraction built on top of Go’s array type, and so to understand slices we must first understand arrays. var mySlice = []int{1,2,3,4,5} var subSlice = mySlice[2:4] So, in other words, the length of subSlice is two because subSlice only cares about two elements. However, the Read more…

Go Array

Planning to store a student who has a maximum of 5 subjects scores and is not a dynamic subject. The compiler will have a fixed memory allocation 5 individual integer size for myStudentscores with initializing values. This avoids of allocation of memory that gets unused.