Sign in
go
/
tour
/
c7374255f627de1d833c24ab73b75f6e7c25ef75
/
.
/
prog
/
struct-literals.go
blob: 51472f4810f4cb004d17f11eaf9e7369ae1dc38b [
file
] [
log
] [
blame
]
package main
import "fmt"
type Vertex struct {
X, Y int
}
var (
p = Vertex{1, 2}
// has type Vertex
q = &Vertex{1, 2}
// has type *Vertex
r = Vertex{X: 1}
// Y:0 is implicit
s = Vertex{}
// X:0 and Y:0
)
func main() {
fmt.Println(p, q, r, s)
}