title: error: expected primary-expression before & token
body: <p>Im writing a program that gets an input file and parses through it, it is supposed to create two arrays <code>WORDS</code> and <code>FREQUENCY</code> and then print out what it got in them.
  Words will have all the words in the file without repeating them. Frequency will have the number of times each word appears on the file. </p>
  
  <p>However I cant seem to get the main to use the files properly and I keep on getting these errors while I try to run my program.</p>
  
  <pre><code>main.cpp:21: error: no matching function for call to 'FileParser::parseFile(Analysis&amp; (&amp;)())'
  fileParser.h:56: note: candidates are: void FileParser::parseFile(Analysis&amp;)
  main.cpp:25: error: request for member 'printListAll' in 'a', which is of non-class type 'Analysis&amp; ()()'
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>//MAIN
  
  
  #include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;fstream&gt;
  
  using namespace std;
  
  #include "analysis.h"
  
  
    #include "fileParser.h"
  
  
  
      int main(int argc, char *argv[])
      {
  
          Analysis a();
  
          //Input Parse
          FileParser input("input.txt");
          input.parseFile(a);
  
      //Output
      ofstream outP("output.txt");
      a.printListAll(outP);
  
      return 0;
  }
  
  
  
  
  ====================
  
  
  
  using namespace std;
  
  #include "word.h"
  
  #ifndef ANALYSIS_H
  #define ANALYSIS_H
  
  class Analysis{
  
      private:
  
          Word** wordList;
          int wordListSize;
          int wordListCapacity;
  
  
          //Resizes the wordList array
          void resize()
          {
              Word** temp = new Word* [wordListCapacity + 10];
              for(int i = 0; i &lt; wordListSize; i++)
                  temp[i] = wordList[i];
  
              delete [] wordList;
              wordList = temp;
              wordListCapacity += 10;
          }
  
  
  
          //Sorts the words in the analysis
          void sortAna()
          {
              for (int i = 0; i &lt; wordListSize - 1; i++)
              {
                  int curSmallest = i;
                  for (int j = i + 1; j &lt; wordListSize; j++)
                      if (*wordList[j] &lt; *wordList[curSmallest])
                          curSmallest = j;
                  if(curSmallest != i)
                  {
                      Word* temp = wordList[i];
                      wordList[i] = wordList[curSmallest];
                      wordList[curSmallest] = temp;
                  }
              }
          }
  
          Analysis(const Analysis&amp;){}
  
      public:
  
  
          Analysis(){
              wordListSize = 0;
              wordListCapacity = 10;
              wordList = new Word*[wordListCapacity];
          }
  
  
          ~Analysis()
          {
              for (int i = 0; i &lt; wordListSize; i++)
                  delete wordList[i];
              delete [] wordList;
          }
  
  
  
  
          bool isInAnalysis(char str[]){
              for (int i = 0; i &lt; wordListSize; i ++)
              {
                  if (wordList[i]-&gt;equals(str))
                      return true;
              }
              return false;
          }
  
  
          void addWord(char str[], int frequency)
          {
              if (wordListSize == wordListCapacity)
                  resize();
  
  
              //Check to see if the exists already, if it does just
              //add to the frequency
              else if (isInAnalysis(str))
              {
                  for (int i = 0; i &lt; wordListSize; i++)    
                  {
                      if (wordList[i]-&gt;equals(str))
                      {
                          wordList[i]-&gt;addFrequencyToList(str);
                          break;
                      }
                  }
              }
  
              //If its a new word
              else
              {
                  wordList[wordListSize] = new Word(str);
                  wordList[wordListSize] -&gt; addFrequencyToList(str);
                  wordListSize++;
              }
          }
  
  
  
          //Print the Analysis in all output form (-a)
          void printListAll(ostream&amp; out)
          {
              sortAna();
              int * tempFrequency;
              for (int i = 0; i &lt; wordListSize; i++)
              {
                  char* str = wordList[i] -&gt; getWord();
  
                  int numFrequency = wordList[i] -&gt; getFrequency();
                  tempFrequency = new int[numFrequency];
                  wordList[i] -&gt; getFrequencyList(tempFrequency);
  
                  //Handle wrapping
  
                  char tempOutput[55];
                  strcpy(tempOutput, str);
                  strcat(tempOutput, " = ");
                  char tempPageNumber[50];
  
  
                  for (int i = 0; i &lt; numFrequency; i++){
                      sprintf(tempPageNumber, "%d", tempFrequency[i]);
                      int currPageLen = strlen(tempPageNumber);
  
  
                      if(strlen(tempOutput) + currPageLen &gt; 49)
                      {
                          out &lt;&lt; tempOutput &lt;&lt; endl;
                          strcpy(tempOutput, "    ");
                      }
                      strcat(tempOutput, tempPageNumber);
                      if(i != numFrequency - 1)
                          strcat(tempOutput, "  ");
                  }
                  //Flush the last set of contents of the buffer
                  out &lt;&lt; tempOutput &lt;&lt; endl;
                  delete[] tempFrequency;
                  delete[] str;
              }
          }
  
  
  };
  
  #endif
  
  
  ==========
  
  
  
  #include "analysis.h"
  #include "word.h"
  
  
  #ifndef FILEPARSER_H
  #define FILEPARSER_H
  
  class FileParser
  {
      private:
  
          char* fileName;
          ifstream cin;
  
      public:
  
          FileParser(char* fName)
          {
  
              fileName = new char[strlen(fName) + 1];
              strcpy(fileName, fName);
  
              cin.open(fileName);
  
              if (!cin.is_open())
                  cerr &lt;&lt; "****ERROR:  Cannot open Input file to parse it. ****" &lt;&lt; endl;
          }
  
  
          ~FileParser()
          {
              cin.close();
          }
  
  
          bool isFileOpen(){
              return cin.is_open();
          }
  
  
          //Returns the length of the string given as an int
          int getFrequencyNumber(char* str)
          {
              return atoi(str);
          }
  
  
          //Parses the given File
          void parseFile(Analysis&amp; a)
          {
  
              char currentWord[50] = {0};
              char currentFrequencyString[10] = {0} ;
              int currentFrequency;
  
              cin &gt;&gt; currentWord;
              while (currentWord[1] != '-')
              {
  
                  if(currentWord[0] == ' ')
                  {
                      //copy from 2nd character of currentWord to before the space
                      //which is at strlen(currentWord)
                      int count = 1;
                      while (currentWord[count] != ' ')
                      {
                          currentFrequencyString[count - 1] = currentWord[count];
                          count++;
                      }
  
                      currentFrequencyString[count - 1] = '\0';
                      currentFrequency = getFrequencyNumber(currentFrequencyString);
                  }
  
                  else
                  {
                      //Convert the word to lower case
                      Word::toLower(currentWord);
  
                      //add to the index (passed in as param) with current freq.
                      a.addWord(currentWord, currentFrequency);
                  }
                  //get next word
                  cin &gt;&gt; currentWord;
              }
          }
  
  
  };
  
  #endif
  
  ===============
  
  
  
  
  using namespace std;
  
  #ifndef WORD_H
  #define WORD_H
  
  class Word{
  
      private:
          char* string;
          int* frequencyList;
          int frequencySize; //Actual number of frequencies in the list.
          int frequencyCap;  //Total size of frequency
          int wordFrequency; //Frequency of a certain word.
  
  
          void resizeFrequency(){
              int* temp = new int[frequencyCap+10];
              for (int i = 0; i &lt; frequencyCap; i++)
                  temp[i] = frequencyList[i];
              delete [] frequencyList;
              frequencyCap += 10;
              frequencyList = temp;
          }
  
      public:
          /**
           * This constructor constructs the word
           * with the parameter value and initializes
           * the frequencyList
           */
          Word(char* input)
          {
              string = new char[strlen(input) + 1];
              strcpy (string, input);
              frequencyList = new int[10];
              frequencySize = 0;
              frequencyCap= 10;
              wordFrequency = 0;
          }
  
  
          // Copy constructor for word
          Word (const Word&amp; rhs)
          {
              string = new char[strlen(rhs.string) + 1];
              strcpy(string, rhs.string);
              frequencyList = new int[rhs.frequencyCap];
              for (int i = 0; i &lt; rhs.frequencyCap; i++)
                  frequencyList[i] = rhs.frequencyList[i];
              frequencyCap = rhs.frequencyCap;
              frequencySize = rhs.frequencySize;
              wordFrequency = rhs.wordFrequency;
          }
  
          //Destructor
          ~Word()
          {
              delete[]string;
              delete[]frequencyList;
          }
  
  
         //Overloaded assignment operator
          Word&amp; operator=(const Word&amp; rhs)
          {
              if(this != &amp;rhs)
              {
                  delete [] string;
                  delete [] frequencyList;
  
                  string = new char[strlen(rhs.string) + 1];
                  strcpy(string, rhs.string);
                  frequencyList = new int[rhs.frequencyCap];
                  for (int i = 0; i &lt; rhs.frequencyCap; i++)
                      frequencyList[i] = rhs.frequencyList[i];
                  frequencyCap = rhs.frequencyCap;
                  frequencySize = rhs.frequencySize;
                  wordFrequency = rhs.wordFrequency;
              }
  
              return *this;
          }
  
  
          //Seeing if given word matches another word.
          bool equals(char* temp)
          {
              if(strcmp(string, temp) == 0)
                  return true;
              return false;
          }
  
  
          //Adds the frequency of the given word to the list
          //and if it already exits, frequency++
          void addFrequencyToList(char* temp)
          {
              if (frequencySize == frequencyCap)
                  resizeFrequency();
  
              //Only adds a new frequency if the word doesn't
              //already appear in the list.
              if (equals(temp))
              {
                  frequencyList[frequencySize] = wordFrequency;
                  frequencySize++;
                  wordFrequency++;
              }
          }
  
  
          //Gets the total size of the frequency list.
          int getFrequency()
          {   
              return frequencySize;
          }
  
  
          //Gets the frequency of a word
          /*int getFrequencyOfWord(char* temp)
          {
              for(int i=0; i&lt;=frequencySize; i++)
              {
                  if (*temp == string[i])
                      return frequencyList[i];
              }
          }*/
  
  
  
          void getFrequencyList(int* tempFrequencyList)
          {
              sort(frequencyList, frequencyList + frequencySize);
              for (int i = 0; i &lt; frequencySize; i++)
                  tempFrequencyList[i] = frequencyList[i];
          }
  
  
          //Returns a copy of the word
          char* getWord()
          {
              char* temp = new char[strlen(string) + 1];
              strcpy(temp, string);
              return temp;
          }
  
  
          //Helper function that converts to lower case.
          static void toLower(char* str)
          {
              int len = strlen(str);
              for (int i = 0; i &lt; len; i++)
                  str[i] = tolower(str[i]);
          }
  
  
          bool operator &lt; (const Word&amp; rhs)
          {
              return (strcmp(this-&gt;string, rhs.string) &lt; 0);
          }
  
  };
  
  #endif
  </code></pre>