In the code below:
s4 := []int{0, 1, 2, 3, 4, 5}
sp4 := &s4
sp5 := &((*sp4)[1:])
I want to get the pointer a slice of s4[1:]
as s5, but this cause an error:
cannot take the address of (*sp4)[1:]
But if I write like this:
s4 := []int{0, 1, 2, 3, 4, 5}
sp4 := &s4
s5 := (*sp4)[1:]
sp5 := &s5
It works!
I have made some tests, and found that when I change *sp5, s4 change as while. That's what I just need.
But why cannot I write sp5 := &((*sp4)[1:])
?