a = make([]int, 7, 15)
creates implicit array of size 15
and slice(a
) creates a shallow copy of implicit array and points to first 7 elements in array.
Consider,
var a []int;
creates a zero length slice that does not point to any implicit array.
a = append(a, 9, 86);
creates new implicit array of length 2 and append values 9
and 86
. slice(a
) points to that new implicit array, where
len(a) is 2
and cap(a) >= 2
My question:
is this the correct understanding?