Multiple scanning methods to access this data
2, 3, 4, 5,
8, 9, 10,
14, 15,
20
#include <stdio.h>intMainvoid){ intarr[5][5] = {1,2,3,4,5, 6,7,8,9,Ten, One, A, -, -, the, -, -, -, +, -, +, A, at, -, - }; inti,j;#if1 for(i=0;i<5; i++) { for(j=0;j<5; j + +) {printf ("%d%d", i,j); //printf ("%3d", Arr[i][j]);} putchar (Ten); } Putchar (Ten);#endif#if0//scanning mode transverse sweep 1.1:2,3,4,5,8,9,10,14,15,20#endif#if0//scanning mode transverse sweep 1.2:5,4,3,2,10,9,8,15,14,20#endif#if0//scanning mode transverse sweep 1.3:20,14,15,8,9,10,2,3,4,5#endif#if0//scanning mode transverse sweep 1.4:20,15,14,10,9,8,5,4,3,2#endif#if0//scanning mode vertical sweep 2.1:2,3,8,4,9,14,5,10,15,20#endif#if0//scanning mode vertical sweep 2.2:5,10,15,20,4.9,14,3,8,2#endif#if0//scanning mode vertical sweep 2.3:2,8,3,14,9,4,20,15,10,5#endif#if0//scanning mode vertical sweep 2.4:20,15,10,5,14,9,4,8,3,2#endif#if1//scan the way obliquely sweep 3.1:2,8,14,20,3,9,15,4,10,5 //Method 1 Recommended intZ; for(i=0, j=1;j<5; j + +) { for(z =0;z+i<5&&z+j<5; z++) {printf ("%3d", arr[z+i][z+J]); }} putchar (Ten); //Method 2 The law of reputation, actually have dine suspicion for(j=1;j<5; j + +) { for(i=0;i<5-j;i++) {printf ("%3d", arr[i][j+i]); }} putchar (Ten);#endif#if0//scan the way obliquely sweep 3.2:5,4,10,3,9,15,2,8,14,20#endif#if0//scanning way oblique sweep 3.3:2,3,4,8,5,9,10,14,15,20 too hard not to. #endif}
4.12 Use different scan sequences to scan the data on the same side of the array.