mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 04:48:29 +08:00
04.4.1.md
This commit is contained in:
11
eBook/examples/chapter_4/testcrash.go
Normal file
11
eBook/examples/chapter_4/testcrash.go
Normal file
@@ -0,0 +1,11 @@
|
||||
// testcrash.go
|
||||
// compiles , but crashes
|
||||
package main
|
||||
|
||||
func main() {
|
||||
var p *int = nil
|
||||
*p = 0
|
||||
|
||||
}
|
||||
// in Windows: stops only with: <exit code="-1073741819" msg="process crashed"/>
|
||||
// runtime error: invalid memory address or nil pointer dereference
|
Reference in New Issue
Block a user