Two Dimensional Arrays in C++

In this article, I will take you through 2D or Two Dimensional arrays in C++ programming language. Before learning about 2D arrays you can learn about arrays from here.

Introduction to Two Dimensional Arrays

The arrays you are generally familiar with are one-dimensional arrays, which means a single row of items. Often, data naturally comes in the form of an array, such as a spreadsheet, which requires a two-dimensional array.

Two Dimensional (2D) arrays are indexed by two indices, one for the row and one for the column.

Two Dimensional Arrays in C++:

2D Arrays are declared similar to 1D arrays but with an additional dimension. Syntax: int arr[rows][columns]. Now let’s see how to create the Two Dimensional arrays in C++ programming language:

3 3
23 45 67
344 56 78
34 56 32

Matrix :
23 45 67
344 56 78
34 56 32

So this is how we create a 2D array by using the C++ programming language. I hope you liked this article on the concept of 2D arrays in C++ programming language. Feel free to ask your valuable questions in the comments section below.

Default image
Aman Kharwal

Coder with the ♥️ of a Writer || Data Scientist | Solopreneur | Founder

Articles: 1236

Leave a Reply