In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article, Xiaobian introduces "how to use Go pointer" in detail, the content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to use Go pointer" can help you solve your doubts.
How to use pointers
Pointer usage process:
Define pointer variables.
Assign a value to the pointer variable.
Access the value in the pointer variable that points to the address.
Precede the pointer type with a * (prefix) to get what the pointer points to.
Example
Package main
Import "fmt"
Func main () {
Var an int= 20 / * declare the actual variable * /
Var ip * int / * declare pointer variable * /
Ip = & a / * Storage address of pointer variable * /
Fmt.Printf (the address of "a variable is:% x\ n", & a)
/ * Storage address of pointer variable * /
Fmt.Printf ("pointer address stored by the ip variable:% x\ n", ip)
/ * use pointers to access values * /
Fmt.Printf ("* ip variable value:% d\ n", * ip)
}
The output of the above example is as follows:
A variable address is: 20818a220ip variable storage pointer address: 20818a220*ip variable value: 20 read here, this "how to use Go pointer" article has been introduced, want to master the knowledge of this article also need to practice to understand, if you want to know more about the content of the article, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.