fork(1) download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void) {
  5. const char * str1 = "test";
  6. char buffer[100] = {0};
  7.  
  8.  
  9. scanf("%s", &buffer);
  10.  
  11. printf("(%s == %s) ? %c", str1, buffer,
  12. (compareStrings(str1, buffer) != 0 ? 'T' : 'F') );
  13. // your code goes here
  14. return 0;
  15. }
  16.  
  17. int compareStrings(const char * first, const char * second)
  18. {
  19. int len1 = strlen(first);
  20. int len2 = strlen(second);
  21.  
  22.  
  23. if(len1 != len2)
  24. {
  25. return 0;
  26. }
  27. int i = 0;
  28. for (; i < len1; ++i)
  29. {
  30. if(first[i] != second[i])
  31. {
  32. return 0;
  33. }
  34. }
  35. return 1;
  36. }
Success #stdin #stdout 0s 2116KB
stdin
asd
stdout
(test == asd) ? F