Похожие чаты

Hey there . https://play.golang.org/p/PbG8OWCBgt1 in this code snippet i created a

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

3 ответов

15 просмотров

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.

Похожие вопросы

Обсуждают сегодня

Карта сайта