Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posts/go/go-array-slice/ #153

Open
utterances-bot opened this issue Sep 28, 2021 · 3 comments
Open

posts/go/go-array-slice/ #153

utterances-bot opened this issue Sep 28, 2021 · 3 comments

Comments

@utterances-bot
Copy link

Go 数组比切片好在哪?

https://eddycjy.com/posts/go/go-array-slice/

Copy link

希望多来点数组跟切片的比较,初学的时候一脸懵逼

@jincheng9
Copy link

切片和数组的本质区别是:切片是一个结构体,里面有一个array指针,指向存放数据的数组。
数组介绍:https://github.com/jincheng9/go-tutorial/tree/main/workspace/lesson10
切片介绍:https://github.com/jincheng9/go-tutorial/tree/main/workspace/lesson13
Go里有引用传递么?https://github.com/jincheng9/go-tutorial/tree/main/workspace/problem/p3

Copy link

访问速度

 var a [2]string{"脑子进","煎鱼了"}
 fmt.Println(a[0], a[1])

var a []string{"脑子进","煎鱼了"}
 fmt.Println(a[0], a[1])

怎么才能看出来有区别?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants