The fairy guides the way, leads but does not send, Go lang1.18 introductory refining tutorial, from Bai Ding to Hongru, the background and difference of the use of New and Make functions in Golang EP16

Original link: https://v3u.cn/a_id_245

Golang has only 25 reserved keywords for the system, and more than 20 built-in functions in the system. In total, there are only about 50 keywords that need to be remembered. Throughout the programming universe, no one can surpass them. Some of these reserved keywords are “icing on the cake”, what is the icing on the cake? On the surface, even if there is no, it is harmless, and it does not affect the implementation of business or logic, such as lambda expressions, etc. It doesn’t matter if there is no, but when initializing the data structure, we can’t avoid talking about two built-in functions. : New and Make. The New function assumes that a variable is declared: packagemainimport “fmt” funcmain(){varastringfmt.Println(a)fmt.Println(&a)} The system returns: 0x140…

This article is reprinted from: https://v3u.cn/a_id_245
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment