Answers for "how to initialize 2d array with values c++"

C++
0

how to initialize 2d array with values c++

int main()
{
    int arr[2][5] =
    {
        {1,8,12,20,25},
        {5,9,13,24,26}
    };
}
Posted by: Guest on May-30-2021
-3

initialize 2d array c++

#include <array>
2 #include <iostream>
3
4 using namespace std;
5
6 //remember const!
7 const int ROWS = 2;
8 const int COLS = 3;


int main(){
 array<array<int, COLS>, ROWS> matrix = {
 1, 2, 3,
 4, 5, 6
 };
  
  
  return 0;
}
Posted by: Guest on May-30-2020

Code answers related to "how to initialize 2d array with values c++"

Browse Popular Code Answers by Language