title: Learning C, and getting errors (I think mostly syntax, but I'm learning!)
body: <p>This program simply takes a file with ASCII lines, puts it into a linked-list stack, and then prints the reversed list to a new file in the same ASCII format. </p>
  
  <p>My struct Code: </p>
  
  <pre><code>typedef struct Node{
  char *info[15];
  struct Node *ptr;
  };
  </code></pre>
  
  <p>I'm getting the following errors:</p>
  
  <pre><code>Errors:
      strrev.c:14: warning: useless storage class specifier in empty declaration
      strrev.c: In function ‘main’:
      strrev.c:28: error: ‘Node’ undeclared (first use in this function)
      strrev.c:28: error: (Each undeclared identifier is reported only once
      strrev.c:28: error: for each function it appears in.)
      strrev.c:28: error: ‘head’ undeclared (first use in this function)
      strrev.c:34: warning: passing argument 1 of ‘strcpy’ from incompatible pointer type
  </code></pre>
  
  <p>/usr/include/string.h:128: note: expected ‘char * <strong>restrict</strong>’ but argument is of type ‘char **’</p>
  
  <p>My main program:</p>
  
  <pre><code>int main(int argc, char *argv[])
  {
  if (argc != 3) {
      fprintf(stderr, "usage: intrev &lt;input file&gt; &lt;output file&gt;\n");
      exit(1);
      }
  
  FILE *fp = fopen(argv[1], "r");
      assert(fp != NULL);
  
  
  Node *head = malloc(sizeof(Node));
  head-&gt;ptr=NULL;
  
  char str[15];
  while (fgets(str, 15, fp) != NULL){
      struct Node *currNode = malloc(sizeof(Node));
      strcpy(currNode-&gt;info, str);
      currNode-&gt;ptr = head;
      head=currNode;
  }
  
  char *outfile = argv[2];
  FILE *outfilestr = fopen(outfile, "w");
  assert(fp != NULL);
  
  while (head-&gt;ptr != NULL){
      fprintf(outfilestr, "%s\n", head-&gt;info);
      head = head-&gt;ptr;
  }
  
  fclose(fp);
  fclose(outfilestr);
  return 0;
  }
  </code></pre>