问个 Golang 的问题~~
資深大佬 : hcyg 51
aData := make([]GateData,len(add)) ArrayToStruct(add,aData)
这个是引用的吗。。不用接收返回值,aData 就变了
大佬有話說 (10)
aData := make([]GateData,len(add)) ArrayToStruct(add,aData)
这个是引用的吗。。不用接收返回值,aData 就变了
type slice struct {
Length int
Capacity int
ZerothElement *byte
}
A slice contains the length, capacity and a pointer to the zeroth element of the array. When a slice is passed to a function, even though it’s passed by value, the pointer variable will refer to the same underlying array. Hence when a slice is passed to a function as parameter, changes made inside the function are visible outside the function too.