# include # include void bw ( int m, int n, int g[m][n] ) { char *filename = "picture.pbm"; int i; int j; FILE *out; out = fopen ( filename, "wt" ); fprintf ( out, "P1 %i %i\n", m, n ); for ( i = m - 1; 0 <= i; i-- ) { for ( j = 0; j < n; j++ ) { fprintf ( out, " %i", g[i][j] ); } fprintf ( out, "\n" ); } fclose ( out ); printf ( "The file \"%s\" contains your graphics data.\n", filename ); return; }