ᗩᖇᖇᗩYՏ
IᑎTᖇOᗪᑌᑕTIOᑎ:
So far we have used only the fundamental data types, namely char, int, float, double and variations of int and
double. Although these types are very useful, they are constrained by the fact that a variable of these types
can store only one value at any given time. Therefore, they can be used only to handle limited amounts of
data, In many applications, however, we need to handle a large volume of data in terms of reading, processing
and printing. To process such large amounts of data, we need a powerful data type that would facilitate
efficient storing, accessing and manipulation of data items, G supports a derived data type known as array
that can be used for such applications,
An array is a fixed-size sequenced collection of elements of the same data type. It is simply a grouping of like-type data. In its simplest form, an array can be used to represent a list of numbers, or a list of names
Some examples where the concept of an array can be used
List of temperatures recorded every hour in a day, or a month, or a year.
List of employees in an organization.
List of products and their cost sold by a store
Test scores of a class of students List
customers and their telephone numbers
Table of daily rainfall data
Since an array provides a convenient structure for representing data, it is classified as one of the data
structures in C, Other data structures include structures, lists, queues and trees
complete discussion of all
data structures is beyond the scope of this text.
As we mentioned earlier, an array
in an organization. We can refer to tho Individual salaries by writing a number called index or subscript if
name. For instance, we can use an array narne salary to ropresent a set of salaries of a group of erployses
brackets after the array name.
For example : salary [10]
represents the salary of "0u employee. Whlle the complete set of values is referred to as an array, indrridual
values are called elements.
item number enables us to develop concise and efficient programs. For example, we can use a loop construd
The ability to use a single name to represent a collection of items and to refer to an item by specifying the
discussed earlier, with the subscript as the control variable to read the entire array, perform calculations, and
print out the results.
dimensions. In this chapter, we introduce the concept of an array and discuss how to use it to create and apply
We can use arrays to represent not only simple lists of values but also tables of data in two, three or more
the following types of arrays.
One-dimensional arrays
Two-dimensional arrays
Multidimensional arrays