Check The Programming Section
Array is a derived data type, which is declared on top of other primary data types in C/C++. At first, we will understnad the need of arrays in programming environment. Then followed with its various application with respect to data storage and processing.
To undesrstand the need of array in C/ C++ programming , consider the image and think about the various paesonal details about these five persons. The information such as, age, height, and weight of these persons and now think how to store these information in a variable and to process them to identify who is young among all of them and wants to display his/her details.
Now you might think what the is problem, I will use multiple variables for this purpose. I will declare 5 variables each for age, wight and height respectievly. These are as follows:
int age1, age2, age3, age4, age5;
float height1, height2, height3, height4, height5;
float weight1, weight2, weight3, weight4, weight5;
Now think about as a programmer perspective. How can a programmer remember whcih age variable (from age1,......, age5) is declared to store the age of first person? So for the time being, he can cosider the varibale notation age1 for first person and age2 for second person and so on. Similarly he can use height1,....., height5 and weight1,......,weight5 as well to store the inforation about the persons height and weight.
Till the storing of values of ages, heights and weights somehow it is OK. But when to process them in a program it will a critical situation for a programmer. Now consider another example depicted in the image.
Very difficult for us to deal with such type of data with primary data types. To handle these series of data of same type (e.g. age as int), C++ provides us a derived data type called array. Let’s define firts what is array?
An array is a collection of similar data items. These data items have the same data type and put under one name. We also represent an array as linear data structure with homogeneous data items into a sequence.
In a computer, each data structure is finite in terms of the number of its elements. A linear data structure has a first and a last element. Each of the other elements in the linear data structure has a predecessor and a successor.
Each element of the array refered by an index, known as its subscript. The index indicates the position or location or ordinal number of the item, counting from the begining of the array. Some examples where the concept of an array can be used are as follows:
List of marks of 2 or more subjects under one name as marks declared as float type array
List of students section wise
Collection of age of all students studying in one class
Array can be used in various parts of our programming life with respect to data structurs, operating systems, database and mathematics, where we have used an array for data processing and storing. These are as follows:
Arrays are used to implement other data structures, such as lists, heaps, hash tables, deques, queues, stacks, strings, and VLists.
For sorting a list of item in ascending and descending order
To search an item from a list of items
It is also used to implement CPU job scheduling algorithms
Arrays are used to implement mathematical vectors and matrices, as well as other kinds of rectangular tables.
Many databases, small and large, consist of (or include) one-dimensional arrays whose elements are records.
Li L. (1998) Linear Data Structures. In: Java: Data Structures and Programming. Springer, Berlin, Heidelberg.
https://en.wikipedia.org/wiki/Array_data_structure#Applications