title: Using malloc to create a linked list
body: <p>i used malloc in order to allocate new nodes in the list,yet i am facing an error with a certain part of my code;
  the following solution applies only to deleting and inserting</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;malloc.h&gt;
  
  struct Node{
      int value;
      struct Node * Next;
      struct Node * Previous;
  
  
  };
  typedef struct Node Node;
  struct List{
      int Count;
      int Total;
      Node * First;
      Node * Last;
  };
  typedef struct List List;
  List Create();
  void Add(List a,int value);
  void Remove(List a,Node * b);
  List Create()
  {
      List a;
      a.Count=0;
      return a;
  
  }
  
  void Add(List a,int value)
  {
      Node * b = (Node *)malloc(sizeof(Node));
      if(b==NULL)
          printf("Memory allocation error \n");
      b-&gt;value=value;
      if(a.Count==0)
      {
          b-&gt;Next=NULL;
          b-&gt;Previous=NULL;
          a.First=b;
  
      }
      else
      {
          b-&gt;Next=NULL;
          b-&gt;Previous=a.Last;
          a.Last-&gt;Next=b;
  
      }
      ++a.Count;
      a.Total+=value;
      a.Last=b;
      }
  void Remove(List a,Node * b)
  {
      if(a.Count&gt;1)
      {
          if(a.Last==b)
          {
              b-&gt;Previous-&gt;Next=NULL;
          }
          else
          {
              b-&gt;Previous-&gt;Next=b-&gt;Next;
              b-&gt;Next-&gt;Previous=b-&gt;Previous;
          }
  
          }
      free(b);
      }
  </code></pre>
  
  <p>in the delete function,in the last else condition,i am not certain whether or not using b->Next->Previous is okay,and will work;when using the -> operator,am i adressing to the node pointer or to it's value?</p>