fork(6) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. const char *p1, *p2, *s1 = "foobar", *s2 = "foobaz";
  5. for (p1 = s1, p2 = s2 ; *p1 && *p1 == *p2 ; p1++, p2++);
  6. const char *p = *p1 || *p2 ? p1 : NULL;
  7. if (!p)
  8. puts("the strings are equal");
  9. else
  10. printf("s1 has %c, where s2 has %c\n", *p, s2[p - s1]);
  11. return 0;
  12. }
  13.  
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
s1 has r, where s2 has z