Nepedia
Back to Discover
Fluent Reader
💻

Pointer (computer programming)

technology Maturity 7-9 Next article →

A pointer is a special tool used in computer programming.

Pointers
Pointers

It does not store a simple value like a number or a letter. Instead, a pointer stores a memory address. A memory address is a specific location where data lives in a computer. You can think of a pointer like a page number in a book's index. The index tells you where to find information. To find that information, you must flip to the correct page. This step is called dereferencing the pointer.

Pointers
Pointers

How a pointer works is a very useful thing that happens in a computer. First, the pointer holds the address of a piece of data. Next, the computer uses that address to find the exact spot in its memory. Then, it can read or change the data at that spot. This is called a level of indirection. It is often much faster to move a small pointer than to copy a huge amount of data. Using pointers makes repetitive tasks, like moving through lists, work much better.

Pointers
Pointers

There is an interesting history behind this idea. In 1955, a scientist named Kateryna Yushchenko created the Address programming language. This language allowed for something very similar to pointers. However, her work was mostly known within the Soviet Union. Most people credit Harold Lawson with inventing the pointer variable. In 1964, he introduced this concept into the PL/I language. This allowed programmers to work with linked lists more easily.

Pointers
Pointers

Because of his work, Lawson received the Computer Pioneer Award in 2000.

Computers use many different types of data to function. A byte is the smallest piece of data a computer can read. Every memory address points to a different byte. Sometimes, a group of bytes is joined together to make a larger piece of data. This group is called an aggregate. A pointer is a type of primitive, which is a simple piece of data. The format of a pointer depends on the computer's architecture.

Pointers
Pointers

For example, some pointers are 64 bits long.

While pointers are helpful, they can also cause big problems. If a pointer tries to look up an address that does not exist, the program might crash. This is sometimes called a segmentation fault. Programmers must be very careful when they use them. If they forget to clean up memory after using a pointer, it can cause a memory leak. This happens when a computer slowly runs out of free memory. However, when used correctly, pointers are a fundamental part of how modern software works.

Pointers
Pointers
421 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (1)
File:Pointers.svg
Pointers.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.