title: Expected declaration specifiers
body: <p>I am learning linked lists in C.  I am new to using pass by references for manipulating the linked lists.  Now I know I'm doing something really foolish in this program.  This program creates a list and then basically returns the number of instances of a particular value(the data of node).  I get an error like so, "Expected declaration specifier" before every statement of main!.</p>
  
  <p>What's going on wrong?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
      #include&lt;malloc.h&gt;
      struct list {
              int number;
              struct list *next;
              };
      typedef struct list node;
      void create(node *);
      int count(node **,int);
      main()
      int key,this_many;
      node *head;
      head = (node *)malloc(sizeof(node));
      create(head);
      printf("Which number?\n");
      scanf("%d",&amp;key);
      this_many = count(&amp;head,key);
      printf("%d times\n",this_many);
      return 0;
      }
      void create(node *list) {
              printf("Enter a number -999 to stop\n");
              scanf("%d",&amp;list-&gt;number);
              if(list-&gt;number == -999) {
                      list-&gt;next = NULL;
              }
              else {
                      list-&gt;next = (node *)malloc(sizeof(node));
                      create(list-&gt;next);
              }
      }
      int count(node **addr_list,int key) {
              int count = 0;
              while(*addr_list != NULL) {
                      if((*addr_list)-&gt;number == key) {
                              count++;
                      }
                      *addr_list = (*addr_list)-&gt;next;
              }
              return(count);
      }
  </code></pre>