title: utf8 character counting not working
body: <p>Can someone please explain why the 1st function works but the 2nd doesn't?</p>
  
  <pre><code>unsigned int utf8_count(char* in)
  {
      unsigned int i = 0, c = 0;
      while (in[i])
      {
          if ((in[i] &amp; 0xc0) != 0x80)
              c++;
  
          i++;
      }
  
      return c;
  }
  
  unsigned int utf8_count(char* in, unsigned int in_size)
  {
      unsigned int i = 0, c = 0;
      while (i &lt; in_size)
      {
          if ((in[i] &amp; 0xc0) != 0x80)
              c++;
  
          i++;
      }
  
      return c;
  }
  </code></pre>
  
  <p>I understand what <code>(in[i] &amp; 0xc0) != 0x80</code> does but I don't understand why <code>i &lt; in_size !=  in[i]</code>?</p>
  
  <p>Example string: <code>ゴールデンタイムラバー／スキマスイッチ</code> 57 bytes, 19 characters.</p>
  
  <p>Why <code>utf8_count(in, 57)</code> return 57 and not 19?</p>
  
  <p>The binary representation of the example string:</p>
  
  <p><img src="https://i.stack.imgur.com/8RD2D.png" alt="enter image description here"></p>