All pastes #9310 Raw Edit

C99 matrixes

public c v1 · immutable
#9310 ·published 2005-04-11 05:39 UTC
rendered paste body
$ cat test-dynmat.c#include <stdio.h>int main() {        int num_col;        int num_row;        printf("Cuantos renglones? << ");        scanf("%d", &num_row);        printf("Cuantas columnas? << ");        scanf("%d", &num_col);        int matriz[num_row][num_col];        int i,j;        for(i=0; i< num_row; i++)                for(j=0; j< num_col; j++)                        if( i == j)                                matriz[i][j] = 1;                        else                                matriz[i][j] = 0;        printf("La matriz identidad para esas dimensiones es:\n");        for(i=0; i< num_row; i++) {                for(j=0; j< num_col; j++) {                        printf("[%3d] ", matriz[i][j]);                }                printf("\n");        }        return 0;}[tigrux@localhost ~]$