Skip to content
Quiz · Structs and methods · lesson 2 of 11

Quiz — copying and comparing structs

Question 1 of 2

What does the program print?

GO
package main

import "fmt"

type Point struct{ X, Y int }

func main() {
    p := Point{X: 1, Y: 2}
    q, r := p, &p
    r.X = 9
    fmt.Println(q.X, p.X)
}

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way