Pointers — the Heart of C — Free C/C++ Tutorial

Learn Pointers — the Heart of C in C/C++ with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

Pointers — the Heart of C — Free C/C++ Tutorial

Learn Pointers — the Heart of C in C/C++ with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

✓ 100% Free ✓ No Login Needed ✓ NCERT / CBSE Aligned ✓ Download as PDF

TL;DR: Learn Pointers — the Heart of C in C/C++ with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated

🤖 Stuck on any question? Ask Syllab's free AI Tutor for a step-by-step explanation — instant, unlimited, no login.

Pointers — the Heart of C in C/C++

A pointer is a variable that stores the memory address of another variable. `int *p = &x;` makes p hold the address of x (& is the "address-of" operator). Dereferencing with *p reads or writes the value stored at that address. Pointers are what make C powerful and fast — and what make it dangerous if misused.

The biggest practical use: pass-by-reference. Because C passes copies, a function that must modify a caller's variable takes a pointer to it. Inside, *p = value writes through the pointer to the original. This is how swap(), and functions that return multiple results, work.

A pointer that points nowhere valid (NULL, or a freed/uninitialised address) must never be dereferenced — that is the infamous "segmentation fault". Always initialise pointers, check for NULL, and set a pointer to NULL after freeing it.

Pointers — the Heart of C — Syntax

int x = 10;
int *p = &x;    // p holds address of x
*p = 20;        // now x == 20

Learn Pointers — the Heart of C step by step with Syllab's free interactive C/C++ tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full C/C++ course →