mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 01:21:38 +08:00
update book code
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
s := "good bye"
|
||||
var p *string = &s
|
||||
*p = "ciao"
|
||||
|
||||
fmt.Printf("Here is the pointer p: %p\n", p) // prints address
|
||||
fmt.Printf("Here is the string *p: %s\n", *p) // prints string
|
||||
fmt.Printf("Here is the string s: %s\n", s) // prints same string
|
||||
}
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
s := "good bye"
|
||||
var p *string = &s
|
||||
*p = "ciao"
|
||||
|
||||
fmt.Printf("Here is the pointer p: %p\n", p) // prints address
|
||||
fmt.Printf("Here is the string *p: %s\n", *p) // prints string
|
||||
fmt.Printf("Here is the string s: %s\n", s) // prints same string
|
||||
}
|
||||
|
Reference in New Issue
Block a user