Types of Array

Bismillahir Rahmanir Rahim

There are two types of Array. 

  1. Single Dimensional Array.
  2. Multi Dimensional Array.

Single dimensional Array:

  • Single or One Dimensional array is used to represent and store data in a linear form.
  • Array having only one subscript variable is called One-Dimensional array
  • It is also called as Single Dimensional Array or Linear Array

Syntax :

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

 

Example of Single Dimensional Array :

int iarr[3]   = {2, 3, 4};

char carr[20] = "ADHOA" ;

float farr[3] = {12.5,13.5,14.5} ;

Program:

 

Multi Dimensional Array :

  • Array having more than one subscript variable is called Multi-Dimensional array.
  • Multi Dimensional Array is also called as Matrix.

Syntax :

<data-type> <array_name> [row_subscript][column-subscript];

Example : Two Dimensional Array

int a[3][3] = { 1,2,3
                5,6,7
                8,9,0 }; 

program:

 

Socializer Widget By Blogger Yard
SOCIALIZE IT →
FOLLOW US →
SHARE IT →