title: how can i add '\0' at the end of a string which is referred to using a pointer?
body: <p>I want to check if string b is suffix of string a. I have tried this so far:</p>
  
  <pre><code>    char a[20], b[20];
      char *p;
      gets(a);
      gets(b);
  
      p = strstr(a,b);
      while(p != NULL)
      {
          if(p + strlen(b) == '\0')
              break;
          p = strstr(p+1, b);
      }
  </code></pre>
  
  <p>I have opened the debugger and have seen that when the program reaches this line:</p>
  
  <pre><code>if(p + strlen(b) == '\0')
  </code></pre>
  
  <p>It never validates to true because p + strlen(b) isn't \0 but just \.</p>
  
  <p>How can I add \0 at the end of what p is pointing to?</p>