1#include <stdio.h>
2
3int readmatrix(size_t rows, size_t cols, int (*a)[cols], const char* filename)
4{
5
6 FILE *pf;
7 pf = fopen (filename, "r");
8 if (pf == NULL)
9 return 0;
10
11 for(size_t i = 0; i < rows; ++i)
12 {
13 for(size_t j = 0; j < cols; ++j)
14 fscanf(pf, "%d", a[i] + j);
15 }
16
17
18 fclose (pf);
19 return 1;
20}