title: Making a linked list from command line arguments
body: <p>I have to make a linked list from arguments entered from the command line. You are supposed to enter integers and make a linked list out of them. When you enter -1, then stop reading from the command line. Fairly simple, but I am having some trouble. What I have is:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  
  struct node
  {
    int grade;
    struct node *next;
  };
  
  int
  main (int argc, char *argv[])
  {
    struct node *root;
    root = (struct node *) malloc (sizeof (struct node));
    root-&gt;next = 0;
    root-&gt;grade = 0;
    int i;
    for (i = 0; i &lt; argc; i++)
      {
        if (&amp;argv[i] == -1)
          {
            break;
          }
        else
          {
            struct node *new_item_ptr;
            new_item_ptr = malloc (sizeof (struct node));
            new_item_ptr-&gt;grade = (*int) argv[i];
            (*new_item_ptr).next = root;
            root = new_item_ptr;
          }
      }
  }
  </code></pre>
  
  <p>I think I'm pretty close, but there are a few things that doesn't work correctly. For example, I don't think <code>for(i = 0; i &lt; argc; i++)</code> is correct. And the compiler says that <code>new_item_ptr-&gt;grade = (*int) argv[i];</code> is wrong also. Can anyone help me out with this? I think I'm close just have a few minor errors. </p>