Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {1,2,0,0}
- {1,1,0,0}
- {1,0,0,0}
- {2,3,4,5}
- 1-2
- 1-1
- 1
- 2-3-4-5
- #include <stdio.h>
- void imprimirMatriz(int (*matriz)[4]){
- FILE *fichero = fopen( "salida.txt", "w" );
- for( int fila = 0; fila < 4; ++fila ) {
- for( int col = 0; col < 4; ++col )
- if( matriz[fila][col]!=0 )
- fprintf( fichero, "%d-", matriz[fila][col] );
- fprintf( fichero, "n" );
- }
- fclose(fichero);
- }
- int main(){
- int matriz1[4][4] = {
- {1,2,0,0},
- {1,1,0,0},
- {1,0,0,0},
- {2,3,4,5},
- };
- imprimirMatriz(matriz1);
- return 0;
- }
- 1-2-
- 1-1-
- 1-
- 2-3-4-5-
Add Comment
Please, Sign In to add comment