title: strncmp function does not stop checking at n characters?
body: <p>My program compares the 2 strings entirely and does not stop once n number of characters are reached? Why does this happen?</p>
  
  <pre><code>int strncompare (const char* mystring1,const char* mystring2, int number)
  {
      int z;
      z = number - 1;
      while ((*mystring1==*mystring2) &amp;&amp; (*mystring1 != '\0') &amp;&amp; (*mystring2 != '\0'))
      {
          *mystring1++;
          *mystring2++;
          if ((*mystring1 == mystring1[z]) &amp;&amp; (*mystring2 == mystring2[z])) 
          {
              break;
          }
      }
      return (mystring1++ - mystring2++);
      }
  </code></pre>