How Pointers Were Invented: From Memory Addresses to C Variables
This article explains how memory addresses are numbered, why direct writes are risky, how symbolic variables simplify programming, the limitations of pass‑by‑value in C, and how introducing pointers provides the necessary indirection to manipulate memory safely and efficiently.
Memory is simply a container of bytes, each byte occupying a numbered location called a memory address.
To write data directly, you can use a machine instruction such as: store 0x8049320 2 This stores the value 2 at address 0x8049320, demonstrating raw memory access.
Direct memory writes are powerful but dangerous: a mis‑calculated address can corrupt data or crash a program.
Because humans find raw numbers hard to manage, programming languages introduce variables as symbolic names (e.g., num) that the compiler maps to specific addresses.
Variables are merely aliases for particular memory cells; the compiler associates the name with the address where the value is stored.
When two functions need to share the same data, pass‑by‑value in C creates separate copies. For example:
void func1(int a) { a = a + 1; }
void func2(int b) { b = b + 1; }
int num = 2;
func1(num);
func2(num);Both functions operate on their own local copies, so num remains 2 after the calls.
The reason is that each parameter ( a, b) receives its own distinct memory cell, not the original num cell.
To let two functions operate on the same cell, an extra level of indirection is required: store the address of num in another variable.
In C this is done with pointers:
int *a; // a holds the address of an int
int b = *a; // dereference a to get the int valueNow a is a pointer that occupies its own memory cell but contains the address 0x8049320 of num. Dereferencing *a accesses the value stored at that address.
Thus a pointer does not point directly to the variable itself; it points to the memory location where the variable resides, providing indirect access.
Higher‑level languages often hide this indirection behind references , which can be treated as alternative names for the same object.
In 1964 Harold Lawson introduced pointers in PL/I, earning the 2000 IEEE Computer Pioneer Award for enabling high‑level languages to manipulate linked data structures such as lists and trees.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
