mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-13 14:10:00 +08:00
Fix "函数" and "方法"
This commit is contained in:
@@ -21,7 +21,7 @@ func TestArray(t *testing.T) {
|
||||
fmt.Println("数组 arr =", arr)
|
||||
// 在 Go 中,指定长度时([5]int)为数组,不指定长度时([]int)为切片
|
||||
// 由于 Go 的数组被设计为在编译期确定长度,因此只能使用常量来指定长度
|
||||
// 为了方便实现扩容 extend() 方法,以下将切片(Slice)看作数组(Array)
|
||||
// 为了方便实现扩容 extend() 函数,以下将切片(Slice)看作数组(Array)
|
||||
nums := []int{1, 3, 2, 5, 4}
|
||||
fmt.Println("数组 nums =", nums)
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ type myList struct {
|
||||
extendRatio int
|
||||
}
|
||||
|
||||
/* 构造方法 */
|
||||
/* 构造函数 */
|
||||
func newMyList() *myList {
|
||||
return &myList{
|
||||
numsCapacity: 10, // 列表容量
|
||||
|
||||
Reference in New Issue
Block a user