"Go 구조체 리터럴"의 두 판 사이의 차이

 
26번째 줄: 26번째 줄:
==같이 보기==
==같이 보기==
* [[Go 구조체]]
* [[Go 구조체]]
* [[Go 리터럴]]


==참고==
==참고==

2022년 2월 10일 (목) 21:55 기준 최신판

1 개요[ | ]

Go Structs
Go 구조체
package main

import "fmt"

type Vertex struct {
	X, Y int
}

var (
	v1 = Vertex{1, 2}  // has type Vertex
	v2 = Vertex{X: 1}  // Y:0 is implicit
	v3 = Vertex{}      // X:0 and Y:0
	p  = &Vertex{1, 2} // has type *Vertex
)

func main() {
	fmt.Println(v1, p, v2, v3)
}

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}