// A struct is a collection of 'fields'
package main
import "fmt"
type Vertex struct {
X int
Y int
}
func main() {
v := Vertex{1, 2}
p := &v
// indirect, access member, increment
(*p).X++
// or alternatively, implicitly indirect and
// increment
p.X++
fmt.Println(v)
}
To embed this program on your website, copy the following code and paste it into your website's HTML: