Various type of array

​One Dimensional Array:

This type of array represents and store data in linear form. It is also called single dimensional array. The general syntax to declare one dimensional array is

[ Size ] ;

In C/C++ language, array name is named constant which can not change during execution of a program. [ ] is subscript operator to mention the size of an array and size should be always a positive value. Some example about declaration of 1- D array and its memory representation is shown as follow.

int a[ 5] ;

Two Dimensional Array (2 D Array) :

This type of array represents and store data in matrix form. The general syntax to declare two dimensional array is :

< Array name < [Rows ] [Columns ] ;

Where array name is a named constant which can not change during execution of program. [ ] is subscript operator to mention the rows and columns of two dimensional array. Each 2- D array is converted into 1- D array before representing in memory. Let a 2- D array of 4 integer values is declared such as

int a[ 2] [2 ] = {4, 5, 6, 8} 

Multidimensional array

C programming language allows multidimensional arrays. Here is the general form of a multidimensional array declaration −

type name[size1][size2]…[sizeN];

For example, the following declaration creates a three dimensional integer array −

int threedim[5][10][4];

Know more at  https://www.tutorialspoint.com

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s