Pointers (Memory Addresses & Dereferencing) - Go Tutorial for Beginners #14
11views
0010:36
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Master pointers in Go - understand memory addresses and direct value manipulation!
In this lesson, you will learn:
✓ What pointers are and why they matter
✓ Address-of operator (&)
✓ Dereference operator (*)
✓ Modifying values through pointers
✓ Pass by value vs pass by pointer
✓ Nil pointers and safety checks
✓ The new() function
✓ Why Go has no pointer arithmetic
⏱️ Timestamps:
0:00 - Introduction
0:27 - Pointer Basics (& and *)
2:25 - Modifying Values via Pointers
4:18 - Pointers in Functions
6:44 - Nil Pointers & Safety
9:10 - Recap
9:40 - End
💻 Source Code: https://github.com/GoCelesteAI/go_pointers
📝 Code Highlights:
// Address-of and dereference
x := 42
p := &x // p holds address of x
fmt.Println(*p) // dereference: prints 42
// Modify via pointer
*p = 100 // x is now 100
// Pass by value - doesn't modify original
func doubleValue(n int) {
n = n * 2 // only changes the copy
}
// Pass by pointer - modifies original
func doublePointer(n *int) {
*n = *n * 2 // changes the original
}
num := 10
doublePointer(&num) // num is now 20
// Nil safety
var p *int // p is nil
if p != nil {
fmt.Println(*p) // safe to dereference
}
📺 Full Playlist: Go Tutorial for Beginners
📺 Previous: Lesson 13 - Anonymous Functions & Closures
📺 Next: Lesson 15 - Structs
👍 Like and Subscribe for more Go tutorials!
#Go #Golang #Programming #Tutorial #Pointers #Memory #LearnToCode
Back to tutorialsOpen in YouTube
Duration
10:36
Published
February 1, 2026
Added to Codegiz
March 15, 2026