title: Can someone explain this code for binary to unsigned int
body: <p>I dont understand how the for loop has bits++ (how can we increment a char pointer?) and how does this code produce an int?</p>
  
  <pre><code>int16_t binary_to_int(char *bits) {
  
      int16_t result;
  
      for (result = 0; *bits; bits++) {
          if (*bits == '1') 
              result = (result &lt;&lt; 1) | 1;
          else if (*bits == '0' ) 
              result &lt;&lt;= 1;
          else 
              break;
      }
  
      return result;
  }
  </code></pre>