Answers for "convert two single dimention arrays to 2d in c++"

C++
0

one dimensiol array to two dimen c++

int arrayOne[100]; /// One dimensional
int arrayTwo[10][10];

for(int i = 0;i<10;i++){
 for(int j = 0;j<10;j++){
   arrayTwo[i][j] = arrayOne[(i * 10) + j];
   //replace 10 width the width of the array when its multidimensional
 }
}

//pee pee poo poo :))))(((
Posted by: Guest on July-16-2021

Browse Popular Code Answers by Language