Skip to content

Instantly share code, notes, and snippets.

@erayarslan
Created September 8, 2017 07:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save erayarslan/6de5cc98ae9dee035af3dd9c7c1cac7d to your computer and use it in GitHub Desktop.
do.ga
package main
import (
"fmt"
"unsafe"
)
func main() {
fmt.Println("Hello, playground")
hi := "HI"
fmt.Println(&hi)
//address is "0x1040c118"
var ptr uintptr = 0x1040c118
printPtrString(ptr)
}
func printPtrString(ptr uintptr) {
p := unsafe.Pointer(ptr)
fmt.Println(*(*string)(p))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment