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

Do we need government AI copyright laws?

AI is transforming creativity — but are we protecting the people behind the art? We explore the UK’s heated debate over AI copyright laws and what they mean for creators and innovation.

8 April 2026

How Do Map Apps Work?

Discover how your map app uses graph theory and clever algorithms to find the fastest route, even before you spot the traffic jam. It’s the smart tech behind every turn and reroute you trust.

What is Chip Binning?

Chip binning is how manufacturers sort silicon chips based on their performance, turning some into high-speed processors and others into more modest models. It’s like baking cookies—some come out perfect, others just good enough.

Meet Dodona: A powerful coding platform built for real classrooms

Discover how Dodona is transforming programming lessons with a powerful, classroom-ready platform built by educators. With the integration of Time2Code, it’s never been easier to deliver engaging, structured coding lessons while saving time and reducing hassle.

Students looking at a hill to climb.

Goals version 2

Until now, the Terms goal has used the Leitner system to determine what students should complete each week. This approach […]

4 April 2026

Differentiation is dead

For decades, teachers were told that differentiation was the golden ticket. If we could just tailor the right task to […]

3 April 2026

It’s not in the mark scheme

Just because it’s not in the mark scheme doesn’t mean it’s wrong — Quicksort proves there are often multiple valid ways to reach the same correct answer.
Understanding the principles behind algorithms matters far more than memorising a single “approved” method.

27 March 2026

Festival Of Computing OCR Fringe Event 2026

The Festival of Computing 2026, co-founded and hosted by Bromsgrove School with AQA as headline sponsor, is the UK’s ultimate […]

24 March 2026

VEX Robotics is inspiring the next generation of Computer Scientists

If you’ve ever wondered how to make computing more engaging for your students, you need to know about VEX Robotics.  […]

18 March 2026