title: C++ Sorting Function
body: <p>So I'm trying to get a sort function to work. It should sort by firstname, but if the first names are the same it should sort by last names. I keep getting an error in <code>mySort()</code> that says "unexpected primary-expression before ')' token" on line where <code>inOrder = arr</code>. What's happening to this and how can I fix it? I need to pass my objects into a function in a seperate class. I'll link them in pastebin.</p>
  
  <p>Here's the driver</p>
  
  <pre><code>#include &lt;iostream&gt; 
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #include "phoneEntry.h"
  using namespace std;
  
  void mySort(PhoneEntry&amp; arr, int size)
  {
      bool inOrder = false;
      for (int i = size - 1; i &gt; 0 &amp;&amp; !inOrder; i--)
      {
          inOrder = true;
          for (int j = 0; j &lt; i; j++)
          {
              inOrder = arr.alphaGreater(arr&amp;);
          }
      }
  };
  
  int main()
  {   
      const int MAXNUM = 500;
      PhoneEntry entry[MAXNUM];
      ifstream filezilla;
      filezilla.open("phone.txt");
      int count = 0;
  
      if(filezilla)
      {
          while(count &lt; MAXNUM &amp;&amp; entry[count].readEntry(filezilla))
          {
              count++;
          }
          mySort(entry&amp;, count);
          for(int i = 0; i &lt; count; i++)
          {
              entry[i].writeEntry(cout) &lt;&lt; endl;
          }
      }
      else
      {
          cout &lt;&lt; "Four Oh Four - File Not Found" &lt;&lt; endl;
      }
  
      return 0;
  }
  </code></pre>
  
  <p><a href="http://pastebin.com/f6Xvu398" rel="nofollow">Phone Entry Header</a></p>
  
  <p><a href="http://pastebin.com/ytdi8x3D" rel="nofollow">Phone Number Header</a></p>
  
  <p>Sorting Text (http://pastebin.com/HE8Rsmbg)</p>