TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Tuesday 16 June 2020

Array Types In C++ | Array Types In C++ Programming Language | Array Types In C++ In Hindi

Array Types In C++


There are three type of array in c language and they are:

1.One dimensional array

2.two dimensional array

3.multi-dimensional array

 

image array type in c++

Fig: Array type in c++

  

      1 .    One dimensional array

 One dimensional array is type of array it use  subscript and the size of array is declare in subscript of array.

 
Syntax:

datatype    arrayname[size];

 

Example:
 

int a[5];

 

Program

#include<iostream.h>

#include<conio.h>

void main()

{

int arr[5]={10,20,30,40,50};

for(int i=0;i<=5;i=+)

{

Cout<<“value of arr[%d] is %d \n”,i , arr[i];

}

getch();

}

 

Output:

value of arr[0] is 10;

value of arr[1] is 20;

value of arr[2] is 30;

value of arr[3] is 40;

value of arr[4] is 50;

 

      2.    Two dimensional array

    Its use two subscript first row and second column and array use for creating matrix in which data is store  on memory in table format.

 

Syntax:

datatype   arrayname[row][column];

 

Example:

int  arr[2][2];

Program:

 #include<iostream.h>

#include<conio.h>

void main()

{

int  arr[3][3], i,j;

cout<<“count 3* 3 Matrix”;

for(i=0;i<=2;i++)

for(j=0;j<=2;j++)

cin>>“%d%d”,&arr[i][j];

for(i=0;i<=2;i++)

for(j=0;j<=2;j++)

cout<<“%d%d”,arr[i][j];

cout<<“\n”;

getch();

}

 

Output:

Count 3*3 matrix

2

2

2

2

2

2

2

2

2

222222222

 

        3.    Multi-deminsional array

In this array we use two are more than two subscript of array.

 

Syntax:

 datatype   arrayname[size][size][size] ;

 

 Example:

int arr[2][2][2];


No comments:

Post a Comment