title: Is using strlen() in the loop condition slower than just checking for the null character?
body: <p>I have read that use of <code>strlen</code> is more expensive than such testing like this:</p>
  
  <p>We have a string <code>x</code> 100 characters long.</p>
  
  <p>I think that</p>
  
  <pre><code>for (int i = 0; i &lt; strlen(x); i++)
  </code></pre>
  
  <p>is more expensive than this code:</p>
  
  <pre><code>for (int i = 0; x[i] != '\0'; i++)
  </code></pre>
  
  <p>Is it true? Maybe the second code will not work in some situation so is it better to use the first?</p>
  
  <p>Will it be better with the below?</p>
  
  <pre><code>for (char *tempptr = x; *tempptr != '\0'; tempptr++)
  </code></pre>