Back

What is a code pointer?

Why pointers are confusing, clever, and occasionally catastrophic

28 October 2025

If you’ve ever dipped your toe into C++ or C# and found yourself bombarded with stars (*) and ampersands (&), you’re not alone. One minute you’re coding a game, the next you’re lost in a tangle of memory addresses, wondering why your variables are playing hide and seek.

Let’s break it down.

Imagine your computer’s memory as a giant library. Every variable you create — like int sandwich = 3; — is a book stored on a specific shelf. A pointer doesn’t hold the sandwich (value) itself. Instead, it’s more like a sticky note that says, “Sandwich is in aisle 4, second shelf from the left.” That sticky note is the memory address. 

This is what a pointer stores — not the actual value, but the location of that value.

Why bother with all this indirection? Efficiency and flexibility. Passing around a pointer instead of a full variable is faster, especially if that variable is large. And crucially, if a function needs to change your sandwich — maybe to add pickles — it can go directly to the source. Without a pointer, you’d be modifying a copy. With a pointer, you’re making changes to the original. 

Result: one nicely pickled sandwich.

But it’s not all tasty treats. Pointers come with dangers. If a pointer directs you to a part of memory that doesn’t contain valid data — or worse, doesn’t exist — you’ll hit what’s called a segmentation fault. Think of it as following a dodgy satnav that tells you to turn left… off a cliff.

Curious to learn more about the fascinating world of code pointers? 

Check out our very own Lesson Hacker’s YouTube video HERE.

For more Lesson Hacker videos, check out the CraignDave YouTube playlist HERE.

Visit our website to explore more cutting-edge tech-transforming news in the computer science world!

Related posts

How does optical disc burning work?

Discover what really happens when you “burn” a CD or DVD—it’s not fire, it’s a laser precisely encoding your data onto the disc. From pits and lands to rewritable mood-ring discs, here’s how your files get stored.

14 August 2026

What is a VPN?

Ever wondered how a VPN really works? Think of it as a clever middleman that keeps your online activity private and your data safe.

12 August 2026

Should parents be sharing your life on social media?

“Sharenting”—where parents share their children’s lives online—might seem harmless, but it comes with risks like identity theft, cyberbullying, and impacts on self-esteem. Learn how families can share responsibly while keeping kids’ privacy safe.

10 August 2026

What Is Concurrency in Computing?

Concurrency is the clever trick your computer uses to juggle multiple tasks at once—without actually doing them simultaneously.
From web pages to deadlocks, discover how this behind-the-scenes magic keeps your digital world running (mostly) smoothly.

7 August 2026

Why are silicon wafers round when chips are square?

Ever wondered why silicon wafers are round when everything they power is square? It’s all down to the way we grow and slice silicon — a fascinating mix of physics, efficiency, and a touch of irony.

5 August 2026

What Is the Best Material for a Smartphone?

Your smartphone isn’t made from one perfect material — it’s a carefully engineered compromise of plastic, metal, glass, and ceramic. Each choice solves a problem… and creates another.

3 August 2026

AI torrenting may not be so legal after all

AI training is facing a legal reality check as courts draw the line between fair use and copyright infringement. We look at why data provenance and licensing are now critical in modern AI development.

31 July 2026

Why are LEDs so efficient?

Ever wondered why LEDs use so little energy? Discover how semiconductors create light directly, using far less energy and heat than traditional light bulbs.

29 July 2026

Why Pixar still chooses CPUs over GPUs

Pixar still relies on CPUs for their final film renders — not because they’re faster, but because accuracy beats speed when every photon counts. Discover why GPUs, despite their power, aren’t perfect for cinematic-quality frames.