Created
October 2, 2017 16:07
-
-
Save inancgumus/9742d22a69a96448ef94c0becb0e1155 to your computer and use it in GitHub Desktop.
Go sizeof
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() { | |
var ageOfUniverse int | |
reservedBytes := unsafe.Sizeof(ageOfUniverse) | |
fmt.Printf("Number of bytes reserved for `ageOfUniverse` variable is %d bytes.\n", | |
reservedBytes) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment