int array[3][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}};
The layout of this array in memory is [0, 1, 2, 3, 4, 5, 6, 7, 8] , which
array[0][0] array[0][1] array[0][2] array[1][0] array[1][1] array[1][2] array[2][0] array[2][1] array[2][2]
Here the difference of memory addresses between array[1][0] and array[2][0] is 3;
So, the array a[18][1024] . The difference between a[i][j] and a[i+1][j] is 1024 bytes (page error size). Thus, every time your inner loop fires, it causes a page error. Your inner loop runs 18 * 1024 times (18432).
andre source share