Source file tour/moretypes/struct-pointers.go

     1  // +build OMIT
     2  
     3  package main
     4  
     5  import "fmt"
     6  
     7  type Vertex struct {
     8  	X int
     9  	Y int
    10  }
    11  
    12  func main() {
    13  	v := Vertex{1, 2}
    14  	p := &v
    15  	p.X = 1e9
    16  	fmt.Println(v)
    17  }
    18  

View as plain text