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

What is E-Ink?

From e-readers to colour screens, discover how e-ink works, why it uses so little power, and why adding colour isn’t as easy as it seems.

24 July 2026

How do drones keep balanced?

Drones don’t hover by staying still — they balance by panicking hundreds of times per second and correcting instantly. Inside, tiny sensors and smart controllers keep them upright in a constant dance with physics.

23 July 2026

Is fetch, decode, execute still a thing?

Fetch, decode, execute: the classic CPU cycle is still alive and well, just turbocharged with pipelines, out-of-order execution, and branch prediction. Modern processors may be chaotic, but underneath it all, the old three-step dance still runs the show.

22 July 2026

Key in a lock with a house keyring.

Time2Code for Python has moved to GoCodeIt and Dodona

Following the closure of Trinket, the Time2Code Python course is now hosted on the GoCodeIt and Dodona platforms. As part […]

21 July 2026

Why is RAM Suddenly So Expensive?

Why has RAM gone from bargain-bin prices to costing like a city break? It’s not your PC suddenly getting fancy — AI data centres are hoovering up memory, and a few big companies are calling the shots.

Am I really Human?

Ever wondered why ticking “I am not a robot” feels like a test of your very humanity? It turns out your human clumsiness is exactly what keeps bots at bay.

20 July 2026

Why are TVs so cheap now?

Ever wondered why you can grab a 43” 4K smart TV for just £120? It’s a mix of industrial-scale manufacturing, razor-sharp competition, and the surprising role your viewing habits play in keeping prices low.

10 July 2026

Four revision techniques that actually work

Stop wasting time on ineffective revision. Learn four proven techniques that improve recall, confidence and exam performance.

8 July 2026

KS3 logo

How can Craig’n’Dave say their new KS3 resources are “curriculum 2028 ready”?

It’s a fair question, so we’d like to explain exactly what we mean. First and foremost, we do not have […]