We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://eddycjy.com/posts/go/slice-discuss/
The text was updated successfully, but these errors were encountered:
大佬,猜一下结果是什么
func main() { s := make([]int, 0) //s = []int{0, 10, 100} s = append(s, 0) s = append(s, 10) s = append(s, 100) fmt.Printf("main 内存地址:%p\n", s) hello(s) fmt.Println(s[0:len(s)]) fmt.Println(cap(s)) fmt.Println(s[0:cap(s)]) }
func hello(s []int) { fmt.Printf("hello 内存地址:%p\n", s) s = append(s, 1000) s = append(s, 10000) s = append(s, 100000) s = append(s, 1000000) s = append(s, 10000000) s[0] = 1000 }
Sorry, something went wrong.
图挂了
No branches or pull requests
Go 切片这道题,吵了一个下午!
https://eddycjy.com/posts/go/slice-discuss/
The text was updated successfully, but these errors were encountered: