title: In C, is it guaranteed that 1/2 == 0?
body: <p>Is it guaranteed in C that <code>1/2 == 0</code>? I need that for an implementation of binary search:</p>
  
  <pre><code>/*
   * len is the array length
   * ary is an array of ptrs
   * f is a compare function
   * found is a ptr to the found element in the array
   * both i and offset are unsigned integers, used as indexes
   */
  
  for(i = len/2; !found &amp;&amp; i &lt; len; i += offset) {
      res = f(c-&gt;ary[i]);
  
      if (res == 0) {
          found = c-&gt;ary[i];
      }
      else {
          offset = (res &lt; 0 ? -1 : 1) * (i/2);
          if (!offset) {
              i = len+1;
          }
      }
  }
  </code></pre>