6

golang的数组和指针的问题,求解答

 3 years ago
source link: https://studygolang.com/articles/34800?fr=sidebar
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

golang的数组和指针的问题,求解答

txgu · 45分钟之前 · 39 次点击 · 预计阅读时间不到 1 分钟 · 大约8小时之前 开始浏览    

在学习golang数组和指针相关知识的时候,创建了一个新的长度为5数组。

并且输出查看了数组元素的指针,系统是64位的,查看后发现起始元素的指针为824634142416,第二个元素的指针为824634142424。这里我是在探究数组元素在内存中是连续的均匀的,可是我往后继续累加之后,发现输出了很奇怪的值。

想探究第6个值和第7个值是哪里来的?

a.png


有疑问加站长微信联系(非本文作者))

280

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:701969077


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK