title: c check two strings for same characters
body: <p>Im just starting to learn C programming and for exercise i found one task. First i have to scan in two strings. Then i have to compare them character by character and if there are any same characters i have to print out the amount of the same characters.
  It has to be done with pointers. So lets i have "boat" and "ship" so the program would return 0. But if it were "boat" and "soap" it would return 2.</p>
  
  <p>This is what i've got so far but when i run it it gives me errors. I put the errors in comments.</p>
  
  <p>Thanks in advance for your help.</p>
  
  <p><pre><code></p>
  
   #include &lt;stdio.h&gt;
   #include &lt;string.h&gt;
  
  int number_of_same_characters(char *, char *);
  
  int main()
  {
      char * first[100];
      char * second[100];
      int  result = 0;    
  
      printf("Enter first string\n");
      gets(*first);
  
      printf("Enter second string\n");
      gets(*second);
  
      result = number_of_same_characters(*first, *second);   
      printf("%d\n", result); 
      return 0;
  }
  
  int number_of_same_characters(char *p, char *q){ //i get this error here - error:  invalid type argument of unary ‘*’ (have ‘int’)
      int counter = 0;
  
          for(int j = 0; *p[j] != '\0' || *q[j] != '\0'; ++j){  //i get this error here -  error: invalid type argument of unary ‘*’ (have ‘int’)    
              if(strcmp(*p[j], *q[j])){       
                   ++counter;        
             }        
      }   
      return counter;
  }
  </code></pre>