Question #208

Author: admin
tags: Go  
package main

import "fmt"

type User struct {
	id    int
	login string
}

// Method with pointer receiver
func (u *User) changeLogin() {
	u.login = "alex"
}

func main() {
	user1 := User{id: 1, login: "tom"}
	user2 := User{id: 1, login: "bob"}

	(&user1).changeLogin()
	user2.changeLogin()

	fmt.Println(user1.login) // ??
	fmt.Println(user2.login) // ??
}
What will be printed?
tom, bob
tom, alex
alex, bob
alex, alex
Nothing, the program will not be compiled
Rate the difficulty of the question:
easyhard