Pointers & Memory Addresses
Direct memory references with & (address-of) and * (dereference) without unsafe pointer arithmetic.
“A GPS coordinate written on a piece of paper. Instead of shipping your entire physical house to a friend, you hand them the GPS coordinates so they can visit and update the house.”
Live Memory & Pointer Simulator
Interact with the buttons below to see how Go stores variable values and pointers in memory addresses.
Key Concepts & Rules To Remember
- `&x` gets the memory address of variable `x`.
- `*p` reads or mutates the value stored at address `p`.
- Safe Go forbids pointer arithmetic (no `p++`).
- Passing pointers avoids copying large structs and enables mutation in functions.
1. Understanding Pointers & Memory Addresses
Direct memory references with & (address-of) and * (dereference) without unsafe pointer arithmetic. In Go, pointers & memory addresses is designed around clarity and high runtime efficiency.
type Account struct { Balance int }
func deposit(acc *Account, amount int) {
acc.Balance += amount // Modifies the original account in place!
}Common Beginner Pitfalls & Mistakes
Knowledge Check
Verify your understanding with these interactive practice questions.
Quizzes
Quick checks for understanding
Multiple-choice with inline explanations—expand to see why.
Finished this lesson?
Mark it as complete to track your overall Go mastery.