今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Pointers
- [Instructor] Go makes use of pointers to hold memory addresses of values. Thankfully, using pointers and go is fairly straightforward. Let's take a look. We'll start by creating a variable of type pointer to T where T is an integer. We'll then declare an initialize a variable B to hold an int value of 100. Rephrase. We'll then declare and initialize B to hold an integer value of 100. At this point we want to assign the memory location of the value 100. To do that, we'll use the int percent operator to generate an address for the location of B. We'll then print out the address currently held at A. Let's now run the program and see what we have so far. This hex decimal value represents the location in my system's memory for variable A. Naturally yours will be different. To print out the actual value at that location. We'll use the star operator to de-reference this pointer value. We'll run the program again.…