亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Print 和 Go 中打印之間的區別

Print 和 Go 中打印之間的區別

Go
楊魅力 2023-07-17 14:05:01
Go 語言中的 fmt.Print("print some") 和 print("print some") 有什么區別?var a intfmt.Print("In Print ", &a, "\n ")print("In print ", &a, "\n")兩者提供相同的結果。結果 :In Print 0xcSameAddressLocationIn print 0xcSameAddressLocation 但是,當我這樣做時:ar := []int{1, 2, 3, 4, 5, 6, 7, 8}print("In print ", &ar, "\n")print("In print ", ar[0], "\n")print("In print ", ar, "\n")fmt.Print("In fmt.Print ", &ar, "\n")fmt.Print("In fmt.Print ", &ar[0], "\n")fmt.Print("In fmt.Print ", ar[0], "\n")fmt.Print("In fmt.Print ", ar, "\n")結果:In print 0xcAddressLocation1In print 1In print [8/8]0xcAddressLocation2In fmt.Print &[1 2 3 4 5 6 7 8]In fmt.Print 0xcAddressLocation2In fmt.Print 1In fmt.Print [1 2 3 4 5 6 7 8]有人可以請教一下這是如何工作的以及“print()”和“fmt.Print()”在 Go 語言中分別做什么嗎?
查看完整描述

1 回答

?
冉冉說

TA貢獻1877條經驗 獲得超1個贊

print() 是內置函數,不能保證它保留在語言中。參見builtin.go



查看完整回答
反對 回復 2023-07-17
  • 1 回答
  • 0 關注
  • 146 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號