'Sparse Matrix by Using Multiple Linked-lists

I want to sum all the row and column values of the sparse matrix and show them as an output by using multiple linked-lists. By doing this I am told to use the struct as shown below and also the struct arrays. Can you please help me how to design the code? I am struggling to code multiple linked-lists also the how to record the row and the columns values by using:

struct Node {
    int row;
    int col;
    int value;
    struct Node *next_right;
    struct Node *next_down;
};
    
struct Node *ArrayOfRows[NR] = {NULL};
struct Node *ArrayOfCols[NC] = {NULL};

To understand the linked list structure I code as if the problem only have one pointer which is the struct Node *next_right but for multiple linked-lists I am troubling to code that.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source