golang快速入门-13-golang的结构体struct
时间:2021-03-18 09:51:10
收藏:0
阅读:34
与c/c++一样
//type 关键字可以定义类型的别名 type myint int //type 关键字可以定义一个结构体 type Book struct { title string auth string } // 传值 func changeBook(book Book) { //传递一个book的副本 book.auth = "666" } // 传地址 func changeBook2(book *Book) { //指针传递 book.auth = "777" }
原文:https://www.cnblogs.com/evoc/p/14553015.html
评论(0)