Skip to content

Instantly share code, notes, and snippets.

@slawosz
Last active December 19, 2015 05:19
Show Gist options
  • Save slawosz/5903255 to your computer and use it in GitHub Desktop.
Save slawosz/5903255 to your computer and use it in GitHub Desktop.
package main
import "fmt"
type Vertex struct {
X, Y float64
}
func main() {
var vertexp *Vertex;
v := Vertex{3, 4}
vp := &Vertex{3, 4}
vertexp = &v
fmt.Printf("%v \n", v.X)
fmt.Printf("%v \n", vp.X)
// *main.Vertex
fmt.Printf("%T \n", vp)
// main.Vertex
fmt.Printf("%T \n", *vp)
// **main.Vertex
fmt.Printf("%T \n", &vp)
// main.Vertex
fmt.Printf("%T \n", v)
// fmt.Printf("%T \n", *v) // wont work (cannot get value from value)
// *main.Vertex
fmt.Printf("%T \n", &v)
// *main.Vertex
fmt.Printf("%T \n", vertexp)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment