title: why this code didn't work(send list as argument)?
body: <p>the code compiled without errors, but when it executed it didn't show correct result. is the problem here related with pointers? especially sending list as argument.
  who can help me, I'm very confused, Thanks...</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  typedef int Element;
  
  typedef struct cell{
      Element val;
      struct cell* next;
  } cell ;
  
  typedef struct List{
      cell *first;
  }List;
  
  void add(List *l, Element e)
  {
  
      List* a=l;
      cell*nve=(cell*)malloc(sizeof(cell));
      nve-&gt;val=e;
      nve-&gt;next=NULL;
      if(a-&gt;first==NULL)
      {
          l-&gt;first-&gt;val=nve;
      }
      else
      {
          while(a-&gt;first!=NULL)
          {
              a-&gt;first=a-&gt;first-&gt;next;
          }
          a-&gt;first-&gt;next=nve;
      }
  }
  void display(List *l){
      List *a=l;
       while(a-&gt;first!=NULL)
          {
              printf(&quot;%d\n&quot;,a-&gt;first-&gt;val);
              a-&gt;first=a-&gt;first-&gt;next;
          }
  }
  
  int main()
  {
      List *x=(List*)malloc(sizeof(List));
      add(x,15);
      add(x,16);
      display(x);
  
  }
   ``
  </code></pre>