#include <stdio.h>

#define NCOL 4

int main (void) {

    int arr[][NCOL] = {{1,2,3,4},
                       {2,3,4,5},
                       {3,4,5,6},
                       {4,5,6,7},
                       {5,6,7,8},
                       {6,7,8,9}};
    int (*p)[NCOL] = arr;
    unsigned int i, nelem, nrows, ncols;
    
    nrows = sizeof  arr/sizeof  *arr;   /* you can only use 'sizeof arr' */
    ncols = sizeof *arr/sizeof **arr;   /* in the scope of declaration   */
    nelem = sizeof  arr/sizeof **arr;   /* to get array size */

    printf ("\n 2D array of unsigned values:\n\n");
    for (; p < &arr[nrows]; p++) {
        for (i = 0; i < ncols; i++)
            printf (" %2d", (*p)[i]);
        putchar ('\n');
    }
    
    printf ("\n sizeof arr   : %2lu  (bytes in array)\n", sizeof arr);
    printf (" sizeof *arr  : %2lu  (bytes per-row)\n", sizeof *arr);
    printf (" sizeof **arr : %2lu  (bytes per-element)\n\n", sizeof **arr);
    printf (" nrows : %2u\n ncols : %2u\n nelem : %2u\n\n",
            nrows, ncols, nelem);

    return 0;
}