title: error: called object type 'int' is not a function or function pointer
body: <p>I have a quicksort that I wrote here:</p>
  
  <pre><code>void swap(int&amp; a, int&amp; b);
  int mid(int lo, int hi);
  
  // My quicksort implementation
  void sort(int vec[], int lo, int hi)
  {
          int mid;
          if (hi &gt; lo) {
                  int i = lo + 1;
                  int j = hi;
                  int p = mid(lo, hi);
                  swap(vec[lo], vec[p]);
                  mid = vec[lo];
                  while (i &lt; j) {
                          if (vec[i] &lt;= mid) {
                                  i++;
                          } else {
                                  while (i &lt; --j &amp;&amp; vec[j] &gt;= mid);
                                  swap(vec[i], vec[j]);
                          }
                  }
                  i++;
                  swap(vec[lo], vec[i]);
                  sort(vec, lo, i);
                  sort(vec, j, hi);
          }
  }
  
  void swap(int&amp; a, int&amp; b)
  {
          int temp = a;
          a = b;
          b = temp;
  }
  
  int mid(int lo, int hi)
  {
          return lo + ((hi - lo) / 2);
  }
  </code></pre>
  
  <p>I tried compiling to an object file with <code>g++ -g -c array.cpp -o array.o</code>
  I get this error:</p>
  
  <pre><code>array.cpp:24:14: error: called object type 'int' is not a function or function
      pointer
              int p = mid(lo, hi);
                      ~~~^
  1 error generated.
  </code></pre>
  
  <p>Everything looks correct. Can anyone help me figure out what is wrong?</p>