3. What is Array?
An Array is a fixed-size sequential collection of elements
of same data types that share a common name.
It is simply a group of data types.
An array is a derived data type.
An array is used to represent a list of numbers, or a list
of names.
6. Declaration of
One-Dimensional
Array:
• The int, float, char are the data type
of an element contained in the
array.
• The size indicates the
maximum number of elements that
can be stored inside the array.
• The size should be either a numeric
constant or a symbolic constant.
Type array-name[size];
7. 1-D Array Example:-
In example, we can see:-
• Float as a datatype,
• Ary as array name, and
• Size 15.
• Ary[0] reference the first
element and ary[14]
reference the last
elements in array
respectively.
float ary[15];
10. 1.) At
Compile Time
Example:-
• Here, int is datatype with
size of an array 4.
• 12 will assign on the first
element(num[0]), 4 will
assign on the second
element(num[1]), and 8 will
assign on the third
element(num[2]).
Int num[3] = {12, 4, 8};
13. Two-
Dimensional
Array
A variable which
represent the list of
item using two index
(subscript) is called
two-dimensional array.
In Two-Dimensional
array, the data is stored
in rows and column
formant.
int disp[1][2]
14. Declaration of
Two-
Dimensional
Array
• Here, the type specifies the data type of elements of an array.
It can be any int, float, char, string.
• The size should be either numeric constant or a symbolic
constant.
Type array-name[row-size][column-size] = {list of
values};
15. Application of
Array
• Using pointer for
accessing array.
• Passing arrays as
function parameter.
• Arrays as members of
structure.
• Using
structure type data as
array element.
• Arrays as dynamic data
structure.