blob: fc32043836f2027d2fca9d8b21f5b64cff8562a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/*
* === FUNCTION ======================================================================
* Name: print_int_array
* Description: Print an int-array with one dimension.
* Use
* print_int_array( *matrix, n1*n2, n2, "matrix" );
* for
* int matrix[n1][n2];
* =====================================================================================
*/
static void
print_int_array ( int array[], /* array to print */
int n, /* number of elements to print */
int nrow, /* number of elements per row */
char *arrayname /* array name */
)
{
int i;
printf ("\n\n array \"%s\", length %d\n", arrayname, n );
printf ("\n index | content\n" );
printf ( " ------+-" );
for ( i = 0; i < nrow; i += 1 )
printf ( "-------" );
for ( i=0; i<n; i+=1 )
{
if( i%nrow == 0 )
printf ("\n%6d | ", i );
printf (" %6d", array[i] );
}
printf ("\n\n");
return ;
} /* ---------- end of function print_int_array ---------- */
|