Pointers
Pointers in the Z1h language are easy to learn. Using pointers in the Z1h language makes it easier to perform some tasks.
Next, let's learn step by step the Z1h language pointers.
We all know that variables are a convenient placeholder to use Character, used to refer to the computer memory address.
The address character of Z1h language is &, and it will return the memory address of the corresponding variable before it is placed in a variable. The
following example demonstrates the address of the variable in memory
num = 10
print ( fmt.Sprintf ( "pointer address:% X", & NUM))
the above code as output the following results, where" c0004d3b70 "is not fixed, depending on the status of the system memory allocated
pointer address: c0004d3b70
Now we have learned what is a memory address and how to access it. Next we will introduce pointers specifically
What is a pointer
A pointer variable points to a value of the memory address. If you use C, C ++, Go Language experience, then it is easy to understand
the declaration of Z1h pointer pointers, you need to use &
for internal access to a variable or literal value, such as:
num = 1
numPtr = & num
or
numPtr = & 1
The magical use of pointers to
be updated …