go_study/bilibili/aceid/struct/test1/test.go
2024-11-15 15:44:26 +08:00

27 lines
340 B
Go

package main
import "fmt"
type myint int
type Book struct {
title string
auth string
}
func printBook(myBook Book) {
fmt.Printf("%v\n", myBook)
}
func changeBook(myBook *Book) {
myBook.title = "Learning Golang"
}
func main() {
var book1 Book
book1.title = "Golang"
book1.auth = "Aaron"
changeBook(&book1)
printBook(book1)
}