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
+5.3k Javascript : Shuffle or randomize array example
+8k Golang : What fmt.Println() can do and println() cannot do
+11.2k Golang : Proper way to test CIDR membership of an IP 4 or 6 address example
+7.6k Golang : Set horizontal, vertical scroll bars policies and disable interaction on Qt image
+14.9k Golang : Submit web forms without browser by http.PostForm example
+14.4k Golang : How to pass map to html template and access the map's elements
+7.2k Golang : Use modern ciphers only in secure connection
+8.6k Python : Fix SyntaxError: Non-ASCII character in file, but no encoding declared
+19.2k Golang : Check whether a network interface is up on your machine
+19.2k Golang : Populate dropdown with html/template example
+16.1k Golang : How to check if input from os.Args is integer?