title: return -1 in C?
body: <p>I was given code and I don't understand why the function <strong>returns -1</strong>. I feel that it is a typo. The code is given below: </p>
  
  <pre><code>int equilibrium(int array[], int size)
  {
      int sum = 0;
      int left_sum = 0;
      int i;
      for (i = 0; i &lt; size; i++) {
          sum += array[i];
      }
      for (i = 0; i &lt; size; i++) {
          if (array[i] == sum - 2 * left_sum) {
              return i;
          }
          left_sum += array[i];
      }
      return -1;
  } 
  </code></pre>