slice and function that take the slice as parameter . it takes the value not pointer and i read when you create your function and it takes a value , it copy the value and doesn't effect on the thing you pass . it means it's safe . this is clear for me . but in this code the memory address of the slice out of the function and the parameter we passed the slice to is are the same . why ? shouldn't be difference ? because they are not the same they should be copy
https://go.dev/blog/slices-intro
The slice passed in as argument is a copy; but yet that copy is pointing to the same underlying array.
Thanks for the info :0
Обсуждают сегодня