Last active
December 19, 2015 05:19
-
-
Save slawosz/5903255 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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