I want to turn a 2D array like this [ [x, y], [a, b], [z, e] ]
into [x, y, a, b, z, e]
I have tried multiple thing with indexes and for loops but most of them don't work and the one that did was very buggy and sketchy how do I do that i c++ i am a beginner, and I am trying to learn about matrices
The best approach would be to create a new array. Use the following code which is quite simple and clear as well
int arr[rows*columns];
int a=0;
int array[rows][columns]={assign values};
for(int i=0;i<rows;i++){
for(int j=0;j<columns;j++){
arr[a]=array[i][j];
a++;
}
}