9951 explained code solutions for 126 technologies


golangHow to create slice with make() and capacity


package main

func main() {
	a := make([]int, 5, 10)
}ctrl + c
package main

default package declaration

make(

creates zero-filled array and returns slice referencing this array

[]int, 5, 10

we're creating array of 10 integers and return a slice of 5 elements from this array