欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Go語言獲取數(shù)組長度的方法

 更新時(shí)間:2015年02月27日 10:22:12   作者:pythoner  
這篇文章主要介紹了Go語言獲取數(shù)組長度的方法,實(shí)例分析了len函數(shù)的使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了Go語言獲取數(shù)組長度的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

復(fù)制代碼 代碼如下:
// getting the length of an array is silly, because the length is part of the array's static type
myArray := [3]int{1, 2, 3}
fmt.Println(len(myArray)) // prints 3
// getting the length of a slice
mySlice := []int{1, 2, 3}
fmt.Println(len(mySlice)) // prints 3

希望本文所述對(duì)大家的Go語言程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • Go 內(nèi)存分配管理

    Go 內(nèi)存分配管理

    這篇文章主要介紹了Go 內(nèi)存分配管理,go 語言實(shí)際內(nèi)存、虛擬內(nèi)存怎么分配,延遲歸還是什么機(jī)制?本文結(jié)合監(jiān)控對(duì)內(nèi)存管理進(jìn)行了觀測,深入學(xué)習(xí)golang對(duì)于內(nèi)存的管理機(jī)制,需要的朋友可以參考一下
    2022-02-02
  • 最新評(píng)論