title: returning a typedef struct in a method in C
body: <p>I'm trying to create a struct that holds parsing information and i want to create a method that returns the stuct with the data filled in. This is what I have so far but I am getting an error saying Parser.c:3: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘<strong>attribute</strong>’ before ‘parseString’</p>
  
  <p>Parser.h</p>
  
  <pre><code>    #include &lt;stdio.h&gt;
      #include &lt;string.h&gt;
  
      typedef struct 
      {
         char* myArguments;
         char* myProgramName;
             int myNumArguments;
  
      }ParserData;
  
  
      ParserData parseString(int argc, char** argv);
  </code></pre>
  
  <p>Parser.c</p>
  
  <pre><code>    #include "Parser.h"
  
      ParserData parseString(int argc, char **argv)
      {
           ParserData tempData;
  
           tempData.myNumArguments = argc;
  
           return tempData; 
      }
  </code></pre>
  
  <p>Mish.h</p>
  
  <pre><code>    #include "Parser.h"
  
      ParserData myParserData;
  </code></pre>
  
  <p>Mish.c</p>
  
  <pre><code>   #include &lt;stdio.h&gt;
     #include &lt;string.h&gt;
     #include &lt;sys/types.h&gt;
     #include &lt;unistd.h&gt;
     #include &lt;sys/wait.h&gt;
     #include "Mish.h"
  
     #define MAXLINE 1024
  
  
     int main(int argc, char *argv[], char **environ)
     {
         char buf[MAXLINE];
         pid_t pid;
             int status;
  
         printf("mish&gt;"); //Print shell
  
         myParserData = parseString(argc, argv);
  
         while (fgets(buf, MAXLINE, stdin) != NULL) 
         {
         buf[strlen(buf) - 1] = 0; /* replace newline with null */
  
         if ( (pid = fork()) &lt; 0)
         {
            printf("fork error");
         }
         else if (pid == 0) /* child */
         { 
            execlp(buf, argv[1], (char *) 0);
            printf("couldn't execute: %s", buf);
            return(127);
         }
  
         /* parent */
         if ( (pid = waitpid(pid, &amp;status, 0)) &lt; 0)
         {
            printf("waitpid error");  
            printf("%% ");
         }
  
         }
  
    return(0);
      }
  </code></pre>