Created
September 8, 2017 07:36
-
-
Save erayarslan/6de5cc98ae9dee035af3dd9c7c1cac7d to your computer and use it in GitHub Desktop.
do.ga
This file contains 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" | |
"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