mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-23 15:48:42 +00:00
15 lines
285 B
C
15 lines
285 B
C
int fun(char a[], char b[]) {
|
|
int len_a = strlen(a);
|
|
int len_b = strlen(b);
|
|
|
|
if (len_a > len_b) return 1;
|
|
if (len_a < len_b) return -1;
|
|
|
|
for (int i = 0; i < len_a; i++) {
|
|
if (a[i] > b[i]) return 1;
|
|
if (a[i] < b[i]) return -1;
|
|
}
|
|
|
|
return 0;
|
|
}
|