title: how to compare to chars using pointers in c?
body: <p>I have an assignment to complete in C.</p>
  
  <blockquote>
    <p>Write a function that recives two pointers to strings, checks if they have the same letter and if does, it will return a pointer to the letter found in the first string.</p>
  </blockquote>
  
  <p>How can I write this function? </p>
  
  <p>I wrote this and it's not working:</p>
  
  <pre><code>char *checkSameChr(char *str1, char *str2)
  {
      while (*str1)
      {
          while (*str2)
          {
              if (*str2==*str1)
                  return str1;
              *str2++;
          }
          *str1++;
      }
      return NULL;
  }
  </code></pre>