string_pointer.go 293 B

12345678910111213
  1. package main
  2. import "fmt"
  3. func main() {
  4. s := "good bye"
  5. var p *string = &s
  6. *p = "ciao"
  7. fmt.Printf("Here is the pointer p: %p\n", p) // prints address
  8. fmt.Printf("Here is the string *p: %s\n", *p) // prints string
  9. fmt.Printf("Here is the string s: %s\n", s) // prints same string
  10. }