title: Implement binary search
body: <p>This is my binary-search: </p>
  
  <pre><code>int binarySearch(int arr[], int value, int min, int max){
    int pos = -1;
  
    while (max &gt;= min &amp;&amp; pos == -1) {
      int mid = (max+min)/2;
  
      if(arr[mid] ==  value){
        pos = mid;
      }else if(arr[mid] &lt; value){
        min = mid +1;
      }else if(arr[mid] &gt; value){
        max = mid -1;
      }
  
    }
    return pos;
  }
  </code></pre>
  
  <p>I call it this way:</p>
  
  <pre><code> //Arr contain values 0-63
  int i = binarySearch(arr, 64, 0, 64);
  </code></pre>
  
  <p>These are the mid values</p>
  
  <pre><code>32 48 56 60 62 63 64
  </code></pre>
  
  <p>At the last check I try to access an element at pos 64, when the last position in the array is 63.</p>
  
  <p>What's wrong with my implementation?</p>