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

Update ch2-07-memory.md

fix code.

byte 溢出   `constant 1234 overflows byte`
This commit is contained in:
smallwhite 2019-01-24 21:24:31 +08:00 committed by GitHub
parent 4fdab8dfce
commit 3fa2700598
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,9 +32,9 @@ func freeByteSlice(p []byte) {
func main() {
s := makeByteSlize(1<<32+1)
s[len[s]-1] = 1234
print(s[len[s]-1])
freeByteSlice(p)
s[len(s)-1] = 255
print(s[len(s)-1])
freeByteSlice(s)
}
```