[Go] Go语言里的结构体文法 →→→→→进入此内容的聊天室

来自 , 2020-12-22, 写在 Go, 查看 112 次.
URL http://www.code666.cn/view/060afc8a
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. type Vertex struct {
  6.         X, Y int
  7. }
  8.  
  9. var (
  10.         p = Vertex{1, 2}  // has type Vertex
  11.         q = &Vertex{1, 2} // has type *Vertex
  12.         r = Vertex{X: 1}  // Y:0 is implicit
  13.         s = Vertex{}      // X:0 and Y:0
  14. )
  15.  
  16. func main() {
  17.         fmt.Println(p, q, r, s)
  18. }
  19. //go/4400

回复 "Go语言里的结构体文法"

这儿你可以回复上面这条便签

captcha