mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 07:34:06 +08:00
14 lines
306 B
Go
14 lines
306 B
Go
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
|
|
}
|