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

GDPR and the US: Can you trust American tech with your data?

Curious about GDPR and US data transfers? Learn how businesses can comply with GDPR when using US-based services like Google, and what you need to watch out for.

When the cloud breaks: lessons for teachers from the AWS outage 

On a busy Monday morning, teachers across the UK found themselves staring at error messages instead of lesson plans, thanks […]

24 October 2025

Time2Code – update to 02-02 Largest number program

A lot of students are getting confused about the success criteria of the largest number program in level 2. The […]

23 October 2025

The hidden cost of non-specialist teaching in Computing

In secondary schools across the UK, a growing concern is emerging around the use of non-specialist teachers—particularly in computing. While […]

17 October 2025

Student in a library.

Smart Revise October 2025 update

Archived tasks no longer appear in a student’s task list It’s a fact, some students don’t complete their Smart Revise […]

11 October 2025

Beyond the classroom: Why networking matters for Computer Science teachers 

Staying siloed in the classroom can limit growth, especially in a fast-moving subject like Computer Science. Building external networks exposes new ideas, provides support, and helps teachers and departments thrive.

10 October 2025

Beyond the bookshelves: rethinking the role of secondary school libraries in 2025 

Secondary school libraries in 2025 shouldn’t just store books — they should inspire, collaborate, and engage students in new and exciting ways. It’s time to rethink the library as a dynamic learning hub, not a quiet relic.

3 October 2025

Why Should I Care About GDPR?

Understanding why GDPR matters. Take control of your data—before someone else does. GDPR isn’t just legal jargon—it’s your digital safety net. Find out how it protects your personal data and why you should care, even if you’re “just” browsing.

30 September 2025

How does blockchain work?

Blockchain may sound complicated, but it’s simply a decentralised digital ledger where everyone can see, but no one can change the records. Discover how this game-changing tech works.