Derik_hacker

Untitled

May 7th, 2026
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. typedef struct node {
  5.        
  6.     int col;
  7.     float val;
  8.     struct node* next;
  9. }node_t;
  10.  
  11.  
  12.  
  13. typedef struct {
  14.  
  15.     int NR;
  16.     int NC;
  17.  
  18.     node_t** rows;
  19.  
  20. }matr_t;
  21.  
  22.  
  23. void MATRwrite(matr_t* M, int r, int c, float val) {
  24.    
  25.     node_t* newNode;
  26.  
  27.     // out newNode ./int col = ??, float val=??; ......next;
  28.  
  29.     newNode = malloc(sizeof(node_t));
  30.     // out newNode ./int col = 1232323121, float val=224232.00000; ......next;
  31.  
  32.     newNode->col = c;
  33.     newNode->val = val;
  34.    
  35.     newNode->next = M->rows[r];
  36.  
  37.     M->rows[r] = newNode;
  38. }
  39.  
  40.  
  41.  
  42.  
Advertisement
Add Comment
Please, Sign In to add comment