1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-24 12:32:21 +00:00

Merge pull request #75 from qichengzx/master

fix issue #74
This commit is contained in:
Xargin 2018-06-03 15:43:03 +08:00 committed by GitHub
commit 6bf497a0dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,7 +163,7 @@ type StringHeader struct {
分析可以发现“Hello, world”字符串底层数据和以下数组是完全一致的
```go
var data = [...]byte{'h', 'e', 'l', 'l', 'o', ',' ' ', 'w', 'o', 'r', 'l', 'd'}
var data = [...]byte{'h', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd'}
```
字符串虽然不是切片,但是支持切片操作,不同位置的切片底层也访问的同一块内存数据(因为字符串是只读的,相同的字符串面值常量通常是对应同一个字符串常量):