Junior — Senior
How does the pointer value change when it is reassigned inside a function
livecode
Task condition
What will be the output of the program?
type Person struct {
Name string
}
func changeName(person *Person) {
person = &Person{
Name: "Alice",
}
}
func main() {
person := &Person{
Name: "Bob",
}
fmt.Println(person.Name)
changeName(person)
fmt.Println(person.Name)
}