// Online C++ compiler to run C++ program online
#include <iostream>
int arr[2][2] = {
{11,12},
{21,22},
};
int main() {
for(int r=0;r<2;r++)
for(int c=0;c<2;c++)
printf("address of arr[%u][%u]: %u\n",r,c, &arr[r][c]);
printf("-----------------------------------------------------------\n");
printf("Value of arr[0]: %u <= same address as the 1st row ()\n",arr[0]);
printf("Value of arr[1]: %u <= same address as the 2nd row ()\n",arr[1]);
printf("So basically 1 dimension is an array of pointers \n");
printf("-----------------------------------------------------------\n");
int *row0 = arr[0];
printf("Now make arr[0] a pointer (int *row0 = arr[0])\n\n");
printf("Value of row0[0]: %u <= if my guess is correct, this is equal to arr[0][0]\n",row0[0]);
printf("Value of row0[1]: %u <= and this is arr[0][1]\n\n",row0[1]);
printf("-----------------------------------------------------------\n");
int *row1 = arr[1];
printf("same for 2nd row (int *row1 = arr[1])\n\n");
printf("Value of row1[0]: %u <= should be arr[1][0]\n",row1[0]);
printf("Value of row1[1]: %u <= and this is arr[1][1]\n\n",row1[1]);
return 0;
}