I am trying to create a matrix, int matrix1[size][size]
, but I have to read the length from the first line of a file.
I can read read from the file with no problem, but then when I try to declare the matrix with the variable given to me by the file there's always a compiling error.
How can I get around this?
Sorry about the English
Edited Code:
int num;
FILE *fp;
fp = argc > 1 ? fopen(argv[1], "r") : stdin;
if( fp == NULL) {
perror(argv[1]);
return -1;
}
fscanf(fp,"%d", &num);
int matriz[num][num];
Error message is warning: ISO C90 forbids variable length array ‘matriz’