package
Version:
v0.0.0-...-9d91cd3
Opens a new window with list of versions in this module.
Published: Oct 15, 2020
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
func Append(slice, data []byte) (b []byte)
Append 练习,此时可以看出GO中只有值传递。此时的 append 函数(接收引用类型)
但却是改变的 slice 的一个副本(拷贝)所以不会改变实参。
Test1 一些基本操作
当声明数组时所有的元素都会被自动初始化为默认值 0
数组是值类型,可以通过 new 来创建。
Test2 切片的一些常规操作。
切片(slice)是对数组一个连续片段的引用(该数组我们称之为相关数组,通常是匿名的)
,所以切片是一个引用类型
注意 绝对不要用指针指向 slice。切片本身已经是一个引用类型,所以它本身就是一个指针!!
Test4 字符串、数组、切片
字符串本质上是一个字节数组
Source Files
¶
Click to show internal directories.
Click to hide internal directories.