[圖解C] Example 703

// Example 703: address of array is linear
// "row major order" in C
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int arrA[2][3] = {{1, 2, 3}, {4, 5, 6}};
    int i, j;
 
    for (i=0 ; i<2 ; i++){
        for (j=0 ; j<3 ; j++){
            printf("arrA[%d][%d] = %d \t in %p\n",
                         i, j, arrA[i][j], &arrA[i][j]);
        }
    }
 
    printf("\naddress is linear and continue.\n");
    printf("\"row major order\" in C\n\n");
 
    system("pause");
    return 0;
}