package main

import "fmt"

type Person struct {
	Name string
	Age int
}
func main() {
	// 方式1
	var p1 Person
	p1.Name = "golang"
	p1.Age = 11
	fmt.Println(p1)

	// 方式2
	p2 := Person{"golang", 11}
	fmt.Println(p2)

	// 方式3
	var p3 *Person = new(Person)
	p3.Name = "golang"
	p3.Age = 11
	fmt.Println(*p3)

	// 方式4
	var p4 *Person = &Person{}
	p4.Name = "golang"
	p4.Age = 11
	fmt.Println(*p4)
}