-
Notifications
You must be signed in to change notification settings - Fork 279
Description
In chapter 2, when introducing pointers, the book says:
A pointer is a memory address; it's the location of where to find the actual value. It's a level of indirection. Loosely, it's the difference between being at a house and having directions to the house.
Now, I'm by no means an experienced programmer and just started with Go two hours ago. I do have a little bit of C experience, though. And I think that the last sentence in the above quote might not really be an adequate real-world analogy of what a pointer is.
I'd say a pointer is more like the coordinates of a house on the map, i.e., kind of a raw address instead of being given directions. For example, let's say there's a liquor store at 64°10′30″N 51°44′20″W. Then those coordinates would be like a pointer to liquor, the value you're trying to retrieve. Further, let's say that that liquor store is called “The House of Liquor”. If you'd take a taxi to get there, you wouldn't ask the driver to drop you at 64°10′30″N 51°44′20″W. Rather, you'd ask to be taken to “The House of Liquor”. In short, “The House of Liquor” is like a variable name, while the coordinates of that place would be equivalent to a pointer, wouldn't they?