Golang builtin.new() function example
package builtin
The new built-in function allocates memory. The first argument is a type, not a value, and the value returned is a pointer to a newly allocated zero value of that type.
Golang builtin.new() function usage example
package main
import "fmt"
type Person struct {
Age int
}
func main() {
human := new(Person)
human.Age = 36
fmt.Println(human)
}
Reference :
Advertisement
Something interesting
Tutorials
+10.9k Golang : How to transmit update file to client by HTTP request example
+13.1k Golang : Handle or parse date string with Z suffix(RFC3339) example
+17.9k Golang : Login and logout a user after password verification and redirect example
+14.4k Android Studio : Use image as AlertDialog title with custom layout example
+23.5k Golang : Read a file into an array or slice example
+14.5k Golang : Overwrite previous output with count down timer
+8.2k Prevent Write failed: Broken pipe problem during ssh session with screen command
+6k Golang : How to verify input is rune?
+8.8k Golang : Get final balance from bit coin address example
+13.9k Golang : Get dimension(width and height) of image file
+14.2k Golang : Fix image: unknown format error
+9.7k PHP : Get coordinates latitude/longitude from string