Hey guys,
I'm trying to make a function that reads a sparse matrix off a textfile and makes a linked list of that matrix
I want it to use <stdio.h> and a node should be in a style like
struct node {
int row;
int col;
int elem;
struct node *down;
struct node *right;
};
Reading off a text file would be like
int linkedlist(void) {
int i, j, row, col, val;
FILE *file = fopen("matrixA.txt", "r");
fscanf(file, "%d", &row);
fscanf(file, "%d", &col);
for(i=0; i<row; ++i) {
for(j=0; j<col; ++j) {
fscanf(file, "%d", &val);
and then putting whatever value into the linked list.
I'm struggling to make this function, and to figure out the starting address of this list.
Please help!