title: Compare Two Character Arrays in C
body: <p>I have a string struct. </p>
  
  <pre><code>struct string
  {
     char *c;
     int length;
     int maxLength;
  }
  </code></pre>
  
  <p>I want to check if two strings are equal.</p>
  
  <p>So I want to run a for loop.</p>
  
  <pre><code>for(int i = 0; i &lt; length; i++)
     if(s1[i] != s2[i]) // This code is more C# than C.
  </code></pre>
  
  <p>s1 and s2 are both string structs.</p>
  
  <p>How do I do this <code>if(s1[i] != s2[i])</code> ?</p>
  
  <p><strong>EDIT:</strong>
  I just did this, is it over kill?</p>
  
  <pre><code>    for(i = 0; i &lt; length; i++)
      if((*s1).c[i] != (*s2).c[i])
      {
          printf("Failed");
          return 0;
      }
  </code></pre>