Thread: Free Sparse Matrix

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    10

    Free Sparse Matrix

    The function receives pointer to the structure that contains a sparse matrix and releases all the engaged memory by the structure.

    How to realize this?


    Code:
    #include <stdlib.h>
    #include <stdio.h>
    
    typedef int Elem;
    typedef struct cell Cell;
    typedef Cell * Matrix;
    
    struct cell {
    	int row;
    	int col;
    	Cell * right;
    	Cell * down;
    	Elem value;
    };
    Code:
    void freeSparseMatrix(Matrix m)
    {
    ....
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Genrate sparse matrix - C99
    By anirban in forum C Programming
    Replies: 0
    Last Post: 06-10-2008, 11:44 PM
  2. Replies: 1
    Last Post: 03-08-2006, 06:47 PM
  3. Matrix and vector operations on computers
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 05-11-2004, 06:36 AM