title: C - Array of words
body: <p>I'm fairly new to programming, so sorry if this question seems trivial. I have looked for the answer, but I can't get a straight one. We've covered this in class, but my brain is just completely failing me right now .</p>
  
  <p>In C, I need to make an array so that each element corresponds to a word. </p>
  
  <p><strong>EDIT:</strong> I just remembered I should do something with a pointer array. So something like this is what I'm doing...</p>
  
  <pre><code>main()
  {
      char *line[MAXLINE];   // This points to the beginning of words in compare[]
      char compare[MAXLINE]; // This is where the words will be read in
      int  counter[MAXLINE]; // Counter for the words that appear more than once
      char c;
      int i = 0;
      int n;
  
      for (n=0; c!=EOF; n++){
          while ((c=getchar())!=' '||c!='\n'||c!=EOF){
              compare[i]=c;
              i++;
          }
          line[n]=compare;
          i = 0;
      }
  </code></pre>
  
  <p>I'm aware that's not the whole thing because I need to make compare have a new address, how would one suggest going about doing that? Do I need to use structs or is there another way? Should I be using malloc for that?</p>
  
  <p>I apologize if I asked a stupid question. Since this is my first post here, any input on the way I went about asking this question is greatly appreciated since I already respect this community incredibly and would not want to ruin it with silly questions. Oh, input on the question itself is also appreciated :)</p>
  
  <p>Thanks,
  Slashstar</p>