title: C function to compare last elements of a string to another using pointers
body: <p>My problem is to see if <code>str1</code> ends with the contents of <code>str2</code>.</p>
  
  <p>I tried this:</p>
  
  <pre><code>int string_ends_with(const char *str1, const char *str2) {
      int len;
      len = strlen(str2);
  
      while ((*str1 == '\0' - len) &amp;&amp; *str1 != '\0') {
          if (strcmp(str1, str2) == 0) {
              return 1;
          } else {
              return 0;
          }
      }
  }
  
  int main() {
      char str[10] = "banana";
      char str1[5] = "ana";
  
      string_ends_with(str, str1);
  
      return 0;
  }
  </code></pre>
  
  <p>What I am doing wrong?</p>
  
  <p>This problem needs to be solved only using pointers.</p>