Python Pointers, Memory Addresses & Dereferencing
A pointer in C is a variable storing the physical memory address of another variable. The address-of operator (&) extracts an address, the dereference operator (*) accesses/mutates the target value, and pointer arithmetic (ptr + i) steps through memory in sizeof(Type) chunks.
"A variable is a house holding furniture (data); a pointer is a piece of paper with the street address of that house written on it."
Deep Dive: How It Works
Address-of (&): Evaluates to the memory address where a variable lives in RAM.
Dereference (*): Accesses the memory cell referenced by the pointer to read or write data.
Pointer Arithmetic: Adding 1 to int* advances the address by 4 bytes.
Syntax Blueprint
int val = 100; int *ptr = &val; *ptr += 50; // val is now 150
Store address in pointer variable and dereference with * to mutate in place.
Core Rules to Remember



Common Beginner Traps & How to Fix Them
Dereferencing an uninitialized or NULL pointer: int *p; *p = 10;.Why it happens: p contains random garbage stack bits; writing to it causes an OS segmentation fault (SIGSEGV).
How to fix: Always assign pointers to a valid address (&var) or allocate heap memory before dereferencing.
Live Interactive Example
Hit Run Code to see it liveYour Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Print Value via Pointer Dereference
Print "Dereferenced: %d\n" accessing value through *ptr.
Finished reading and practicing?
Mark this lesson as completed to update your course progress.