I have some exp in C and I am completely new to golang
func learnArraySlice() {
intarr := [5]int{12, 34, 55, 66, 43}
slice := intarr[:]
fmt.Printf("the len is %d and cap is %d \n", len(slice), cap(slice))
fmt.Printf("address of slice 0x%x add of Arr 0x%x \n", &slice, &intarr)
}
Now in golang slice there is an array reference that contains a pointer to the len array of the fragment and the slice cap, but this fragment will also be allocated in memory, and I want to print the address of this memory. But I can’t do it.
source
share