Header Ads

Arrays

INTRODUCTION TO ARRAYS



So, What is an array?
Have you ever studied about data types?
First of all, I will tell about data types in any programming language.
Data type of a value represents that what type of data a value can have. For ex - integers, float, characters etc.

Arrays : 

Arrays are the collection of homogeneous (same type of) type of data which are stored at contiguous (together in sequence) memory location. For example - String is an array of characters.


There are two types of arrays :


1. Single Dimensional Array : Single dimensional array are used to represent and store data in linear form.

Syntax:

<data-type> <name>[size];

For example: 

Declaration of 1-D array of integer type of name "Number" having size 5 & program to print array in C.
This figure illustrates you - 



2. Multi-Dimensional Array : Multi-Dimensional array are those arrays which has more than one dimension. These are like arrays of array.

Syntax:

<data-type> <name>[size-1]_ _ _[size-n];

For example - 

Program of 2-D Array (initialisation)

OUTPUT - 

2-D Array : 


No comments

Powered by Blogger.