58 Star 604 Fork 281

ShirDon-廖显东 / Go Web编程实战派源码

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
1.4-struct-pointer.go 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
ShirDon-廖显东 提交于 2021-01-19 21:25 . commit
//++++++++++++++++++++++++++++++++++++++++
// 《Go Web编程实战派从入门到精通》源码
//++++++++++++++++++++++++++++++++++++++++
// Author:廖显东(ShirDon)
// Blog:https://www.shirdon.com/
// 仓库地址:https://gitee.com/shirdonl/goWebActualCombat
// 仓库地址:https://github.com/shirdonl/goWebActualCombat
//++++++++++++++++++++++++++++++++++++++++
package main
import "fmt"
type Books struct {
title string
author string
subject string
press string
}
func main() {
var bookGo Books /* 声明bookGo为Books类型 */
var bookPython Books /* 声明bookPython为Books类型 */
/* bookGo描述 */
bookGo.title = "Go Web编程实战派从入门到精通"
bookGo.author = "廖显东"
bookGo.subject = "Go语言教程"
bookGo.press = "电子工业出版社"
/* bookPython描述 */
bookPython.title = "Python教程xxx"
bookPython.author = "张三"
bookPython.subject = "Python语言教程"
bookPython.press = "xxx出版社"
/* 打印 bookPython 信息 */
printBook(&bookGo)
/* 打印 bookPython 信息 */
printBook(&bookPython)
}
func printBook(book *Books) {
fmt.Printf("Book title : %s\n", book.title)
fmt.Printf("Book author : %s\n", book.author)
fmt.Printf("Book subject : %s\n", book.subject)
fmt.Printf("Book press : %s\n", book.press)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/shirdonl/goWebActualCombat.git
git@gitee.com:shirdonl/goWebActualCombat.git
shirdonl
goWebActualCombat
Go Web编程实战派源码
bcfc89f778fc

搜索帮助

344bd9b3 5694891 D2dac590 5694891