/ˈpɔɪntər/

noun … “Variable storing a memory address.”

Pointer is a variable in programming that stores the address of another variable or memory location, rather than the data itself. Pointers provide direct access to memory, enabling efficient data manipulation, dynamic allocation on the heap, and complex data structures like linked lists, trees, and graphs. They are widely used in low-level languages such as C and C++ and are fundamental for systems programming and memory management.

Key characteristics of Pointer include:

  • Address storage: holds the location of another variable rather than its value.
  • Dereferencing: accessing or modifying the value stored at the memory address.
  • Pointer arithmetic: allows navigation through memory, particularly in arrays or buffers.
  • Null safety: uninitialized or invalid pointers can cause segmentation faults or undefined behavior.
  • Integration with dynamic memory: used to allocate, pass, and free memory blocks on the heap.

Workflow example: Using pointers in C:

int value = 42
int* ptr = &value        -- Store address of value
*ptr = 100                 -- Modify value via pointer
printf("%d", value) -- Outputs 100

Here, ptr stores the address of value. Dereferencing *ptr allows direct modification of the memory content, demonstrating how pointers facilitate indirect access.

Conceptually, Pointer is like a GPS coordinate: it doesn’t contain the object itself but tells you exactly where to find it, allowing precise navigation and manipulation.

See Memory, Heap, Memory Management, Array, Pointer Arithmetic.