You are on page 1of 6

Array in

C Programming

By Ariful Asfake Sunny


Web Developer and Product Designer
C
Array

❖ Array is a data structure or collection of similar data elements stored at a contiguous


memory location. But it is often more useful to think of an array as a collection of
variables of same type.
❖ Each elements of an array is of same data type and carries the same size. I.e. int = 4
bytes.
❖ Elements of array are stored at contiguous memory locations, where first one is stored
at smallest location.
C
Array
NEED OF USING ARRAY

In most of the cases we need to store a large amount of data of similar


type. We need to define numerous variables to store suchy amount of
datas. While writing programs, it would be very tough to memorize all the
variables names. Instead it is better to define an array and stored all the
elements in it.
C
Array
ARRAY SYNTAX

Syntax:
Data_type array_name [array size] ;

Example:
int amar_array [8] ;
C
Array
ADVANTAGE OF ARRAY

❖ Less code to access the data.


❖ It represents multiple data elements of same type using a single name.
❖ Randomly accessing or searching an array element is easy by using index
number.
❖ By using a loop, we can retrieve the elements of an array easily
C
Array
DISADVANTAGE OF ARRAY

❖ We can store only fixed size of elements in array. So time by time size of
array growing is impossible.

You might also like