/* * Task 2 - Kronecker Product * * GUEST LANGUAGE: THIS IS THE C VERSION OF ch-2.pl. */ #include #include #include #include #include #include #include #include bool debug=false; #define MAXROWS 20 #define MAXCOLS 20 typedef int matrix[MAXROWS][MAXCOLS]; // process_flag_noarg( argc, argv ); // Process the -d flag, and check that there are no // remaining arguments. void process_flag_noarg( int argc, char **argv ) { int arg=1; if( argc>1 && strcmp( argv[arg], "-d" ) == 0 ) { debug = true; arg++; } int left = argc-arg; if( left != 0 ) { fprintf( stderr, "Usage: kronecker-product [-d]\n" ); exit(1); } } // // mat_show( m, rows, cols ); // Show matrix m // void mat_show( matrix m, int rows, int cols ) { // first, calculate the max cell width int width = 1; for( int i=0; i width ) { width = len; } } } #if 0 fprintf( stderr, "width=%d\n", width ); exit(1); #endif for( int i=0; i