If you ask where the variables are stored, the shepherd boy laughed and said to use pointers, Go lang1.18 introductory refining tutorial, from Bai Ding to Hongru, the use of go lang type pointers (Pointer) EP05

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

What does a pointer mean? A pointer is a variable that stores the memory address of another variable. A variable is a convenient placeholder for referring to a computer memory address. A pointer variable can point to the memory address of any value. It points to the memory address of that value. By analogy, a pointer is a table of contents in a book, which itself occupies the pages of a book. It can not only obtain chapter contents through the table of contents, but also point to the number of pages (addresses) of specific chapters. A pointer declaration declares a pointer, *T is the type of the pointer variable, which points to the value of type T: varvar_name*var-typevar-type is the pointer type, var_name is the pointer variable name, and the * sign is used to specify that the variable is used as a pointer. For example: varip*int/*points to int*/varfp*float32/*points to float*/ We used to use & keyword to get variables before…

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

Leave a Comment