A computer uses lists.
Computers use special lists.
Computers use special lists called arrays.
Some arrays are simple lines. We call these one-dimensional arrays. Other arrays look like grids. These are two-dimensional arrays, or matrices.
Many programs use arrays every day. They help make lists and strings. They are also used to build databases. Arrays are very important. They help computers work in a fast and efficient way. Most modern computers use arrays to manage their memory.
An array is a very important tool in computer science. It is a way to organize a collection of items in a computer's memory.
Arrays work using a special math formula.
Computers have used arrays since the very beginning.
There are different ways to shape an array. A one-dimensional array is just a single line of items. A two-dimensional array looks like a grid with rows and columns. These grids are often called matrices.
Many things you use every day rely on arrays. They help run large databases that store lots of records. They are also used to make mathematical vectors.
In computer science, an array is a fundamental data structure. It consists of a collection of elements, which can be values or variables. Every element in an array must have the same memory size and data type. This uniformity allows the array to be a mutable and linear collection. Arrays are essential because they allow computers to organize and access data very efficiently. Almost every computer program uses them to manage information.
The way an array works is based on mathematical precision. Each element is identified by at least one array index, also known as a subscript. To find an element, the computer uses a specific formula to compute its memory address. This calculation starts from the base address, which is the starting position of the array in memory. For a one-dimensional array, the computer uses the index to find the exact location. If you have an array of ten 32-bit integers starting at address 2000, the element at index i is found at address 2000 + (i × 4). This mathematical link between the index and the address makes arrays incredibly fast for computers to process.
Arrays can take several different shapes or dimensions. A one-dimensional array is a simple linear list of items. A two-dimensional array forms a grid with rows and columns, often called a matrix. You can even have three-dimensional arrays, which add depth to the grid.
The history of arrays is tied to the birth of digital computing. Early computers used machine-language programming to manage arrays for math and data tables. In 1945, John von Neumann wrote the first array-sorting program, known as a merge sort. This happened while the first stored-program computers were being built. Over time, programming languages evolved to make arrays easier to use. FORTRAN, created in 1957, provided support for multi-dimensional arrays. C, released in 1972, also included this support. Later, C++ introduced class templates in 1983 to handle arrays with dimensions fixed at runtime.
Different programming languages use different rules for numbering their indices. This is known as the indexing system. In zero-based indexing, the first element is at index 0. This is a popular design choice used by influential languages like C, Java, and Lisp. It works well because the index acts as an offset from the starting position. Other systems use one-based indexing, where the first element is index 1. Some languages, like Fortran 90 or Pascal, even allow users to choose their own starting index.
Arrays are used for many complex tasks in modern technology. They are used to implement other data structures, including lists, strings, stacks, and queues. Large databases often use one-dimensional arrays to store records. In mathematics, arrays are used to represent vectors and matrices. They can even be used to control the flow of a program through control tables. This allows a program to follow different paths based on the values stored in the array. Because they are so space-efficient, they are often used to emulate dynamic memory allocation in a program.
To manage these complex structures, computers often use a "dope vector." This is a record that contains the array's descriptor. It packs together important details like the dimension, the base address, and the address increments. It may also include the size of each element and the allowed range for indices. By manipulating the dope vector, a computer can perform tasks like slicing a sub-array or reversing the order of elements very quickly. This makes the array a powerful and flexible tool for both programmers and the machines they use.
🖼️ Images & Media (5)
More to explore
✨ What else?
Related topics you might enjoy
🔬 Go deeper
More advanced topics to explore
🪜 Step back
Simpler topics to build understanding
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.