1. ## Create Sparse Matrix

I need build function that creates a structure for sparse empty matrix (that in entirety nils ) and returns pointer to the created structure

I need to use the functions malloc in order to create a new member from type Cell, and the address that received to return, after zeroed the member in order that will adapt to the head of the structure (line of nil, column of nil, and nullification pointersof to the right and down )

how to write this algorithm , somebody help!

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:
```newSparseMatrix ()
{
....
}``` 2. so you do the easy work and want someone else to do the hard work? the best way to figure it out is to try it. 3. I think it is necessary to make so but is not assured of it

Code:
```Matrix newSparseMatrix(){

A = (*Cell)malloc(sizeof(Cell));
Matrix A->row = NULL;
Matrix A->col = NULL;
Matrix A->row = NULL;
return A;
}``` 4. If I learn as correctly it to make, it will solve to me all problems 5. having a hard time following your post malloc() an object of type struct cell each of whose elements are NULL and return a pointer to that object? have I got it or am I totally off? 6. I have not so understood a question 7. So you've got five things to set (four if you don't care about the value). 8. calloc() is a better choice if all you want to do is create a matrix with a "hole" in it as calloc() resets all bits. 9. I can`t use calloc () 10. Be able, I might, to provide an answer, if the question, I could, understand! 11. Originally Posted by iMalc Be able, I might, to provide an answer, if the question, I could, understand! 12. ## void freeSparseMatrix( Matrix m )

i am stuck with the same assgiment....but with a diffrent part....
can some one healp with the void freeSparseMatrix( Matrix m )  Popular pages Recent additions 