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

I am a programmer from India, and I am here to guide you with Data Science, Machine Learning, Python, and C++ for free. I hope you will learn a lot in your journey towards Coding, Machine Learning and Artificial Intelligence with me.

Leave a Reply