Arrays can be linear (one dimension) or multi-dimensional. What is the difference between these arrays as long as they give the same result?
I think an array is a set of consecutive addresses of the same type and size in memory. Is this applicable to multi-dimensional array?
#include <iostream>
using namespace std;
int main()
{
int array1[4] = {0, 1, 2, 3};
int array2[1][4] = {0, 1, 2, 3};
int array3[1][2][2] = {0, 1, 2, 3};
cout << array1[0] << endl; // 0
cout << array2[0][0] << endl; // 0
cout << array3[0][0][0] << endl; // 0
cout << array1[2] << endl; // 2
cout << array2[0][2] << endl; // 2
cout << array3[0][1][0] << endl; // 2
return 0;
}