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

Teacher looking at a laptop computer.

June 2026 update

The June 2026 update to Smart Revise introduces a range of quality-of-life improvements requested by teachers and students. These updates […]

20 June 2026

Coding in the age of AI: Why it still belongs in the classroom

As AI transforms the way we write software, should we stop teaching students to code? This blog explores why coding is about far more than programming – developing the critical thinking, problem-solving and digital literacy skills that will matter more than ever in an AI-driven world.

19 June 2026

Pearson – shaping the future of computing education

We caught up with Tim Brady, Subject Advisor for Computer Science and Digital at Pearson, to explore the future of computing education, evolving assessment, and why Pearson is proud to support this year’s Craig’n’Dave Festival of Computing.

18 June 2026

Social media app icons on a phone.

What the proposed UK social media changes mean for Craig’n’Dave teachers

You may have seen recent news coverage about the UK Government’s plans to introduce a ban on social media use […]

17 June 2026

Helping Teachers Thrive in a Digital World: CAS at the Festival of Computing

At the heart of the UK’s computing education community sits Computing at School (CAS) — a powerful network of educators, […]

27 May 2026

Taking the next step

Teaching careers rarely follow a straight ladder, and the most valuable opportunities are often the ones that sit to the side of it. The key is understanding what each role really gives you — and whether that’s career progression, professional growth, or both.

22 May 2026

Cambridge OCR: Supporting Teachers, Inspiring Students & at this year’s Festival of Computing

Cambridge OCR, a leader in UK Computing education, is sponsoring this year’s Festival of Computing —bringing expert insight, CPD, and a passion for supporting teachers. Discover how they’re shaping the future of qualifications and why you won’t want to miss connecting with them at the event.

15 May 2026

Would we do it again?

As May edges closer to its final days, many teachers find themselves staring at the same date every year: 31 […]

8 May 2026

AQA at the Festival of Computing 2026

AQA, the UK’s largest exam board and education charity, joins the Craig’n’Dave Festival of Computing 2026 as Headline Sponsor, bringing expert insight, CPD sessions and curriculum expertise to support secondary Computer Science teachers.

7 May 2026