how to use one loop for two array c++ code example
Example: loop over multidimensional array c++
int arr[2][3] = {
{1,2,3},
{4,5,6}
};
for(int i=0 ; i<sizeof(arr) / sizeof(arr[0]) ; i++){
for(int j=0 ; j<sizeof(arr[i])/sizeof(arr[i][0]) ; j++){
cout<<"2D array have: "<< arr[i][j]<<endl;
}
}