123456789101112131415161718192021222324 |
- #include <stdio.h>
- int strcompare(const char *str1, const char *str2) {
- const char *p = str1;
- const char *q = str2;
- while (*p == *q && *q != '\0' && *p != '\0') {
- p++;
- q++;
- }
- return *p - *q;
- }
- int main() {
- char str1[100], str2[100];
- scanf("%s", str1);
- scanf("%s", str2);
- int result = strcompare(str1, str2);
- printf("%d\n", result);
- return 0;
- }
|