some code as below
type TUser struct {
Name string
Addr string
}
var UserMap map[int]*TUser //save TUser pointer to map
func LoadUsers() {
... ...
//assume "row" contains the results of table "users" from db
UserMap[0] = &TUser{Name:row["name"], Addr:row["addr"]}
}
My question is: After the function "LoadUsers" returns, is the pointer in "UserMap[0]" valid? or it would become a wild pointer like we do the same thing in C language?
Thanks