Glossary · Programming

Pointer

A pointer is a variable that stores the memory address of another value, letting a program access or modify data indirectly.

Updated October 6, 2026

A pointer is a variable whose value is the memory address of another piece of data. Instead of holding the data itself, it refers to where the data lives, and the program can follow the pointer to read or change it.

Why it matters

Pointers let programs share large data without copying it, build linked structures such as lists and trees, and work directly with memory in languages like C and C++. They are also a leading source of serious bugs. A pointer to freed memory (a dangling pointer), a null pointer that is dereferenced, or arithmetic that runs past the end of a buffer can crash a program or create security vulnerabilities. Many newer languages hide raw pointers behind references that the runtime keeps safe.

Example

int x = 10;
int *p = &x;   // p holds the address of x
*p = 25;       // write through the pointer
// x is now 25

&x takes the address of x, and *p follows the pointer to the value stored there.

Common mistakes

  • Dereferencing a null or uninitialized pointer.
  • Using a pointer after the memory was freed.
  • Confusing the pointer with the thing it points to when copying (copying a pointer does not copy the data).

Get notified when this term updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.