Question:
how to read a matrix from a file in C language?
pavan_g_03
2006-04-15 23:57:28 UTC
how to read a matrix from a file in C language?
One answer:
keshavanvrajan
2006-04-15 23:59:37 UTC
Depends on the structure of the file. Assuming the matrix is written out into the file like human beings write it, then if you know the number of columns per row, then all you need to do is do something like this..

for (i = 0; i < no_rows; i++)

for (j = 0; j < no_columns; j++)

scanf ("%d", &a[i][j]);


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...