title: Comparing two files in c
body: <p>As the title says I need to compare 2 files.If a line comes by ,that isnt the same between this 2 files,print that line (From both files).The code is giving a don't send error.I can't seem to be able to find the error in my code.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #define MAX 1000
  
  int main(int argc, char *argv[]) {
      char c1, c2;
      char s1[MAX], s2[MAX];
      char *p1;
      char *p2;
      FILE *fp1;
      FILE *fp2;
      fp1 = fopen(argv[1], "r");
      fp2 = fopen(argv[2], "r");
      p1 = s1;
      p2 = s2;
      if (argc != 3) {
          printf("Wrong use of program \n ");
          return -1;
      }
      if (fp1 == NULL || fp2 == NULL) {
          printf("One or both of the files can't be used \n ");
          return -1;
      }
      while ((c1 = getc(fp1)) != EOF || (c2 = getc(fp2)) != EOF) {
          *p1 = c1;
          *p2 = c2;
          p1++;
          p2++;
  
          for (c1 = getc(fp1); c1 != '\n'; p1++) {
              *p1 = c1;
          }
          *p1 = '\0';
  
          for (c2 = getc(fp2); c2 != '\n'; p2++) {
              *p2 = c2;
          }
          *p2 = '\0';
          if (!(strcmp(s1, s2))) {
              printf("%s \n ", s1);
              printf("%s \n ", s2);
              return 0;
          }
      }
      return 0;
  }
  </code></pre>