Sunday, 21 January 2018

What is Array in C language?


Welcome back! In this post I will explain a very important concept that is Array. It is used for storing a single data item programmers uses variables; but in many applications, programmers need to store a large amount of data, thus for storing large amount of data we need to declare large number of variable which is not convenient. And these variables are independant and not related with each other, so for storing large amount of data C provides the concepts of Array.

Array means collection. An aaray is used to store elements of the same type. It is a very popular and useful data structure and stores elements in contiguous locations. More than one element is arranged in sequence so it is also called a composite data structure.

Array is a liner and homogenous data structure. Homogenous means that the same types of elements are stored in it. It can be combined with a non-homogenous structure and a complex data structure can be created.
For example, when we declare a variable,
 int x;
The variable x is declared and a memory location of two bytes is allocated to it. Later, a single value can be stored in it.

Every variable has a name, value and memory location. Hence, from the above, we can say that only value can be stored in a variable.

0 comments:

Post a Comment