From 0f49a1ebae73c1e431c055e055a7c4e0a8b07431 Mon Sep 17 00:00:00 2001 From: mallowday Date: Thu, 1 Feb 2024 11:16:15 +0900 Subject: [PATCH] edit b.c --- abc042/b.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/abc042/b.c b/abc042/b.c index 08470ed..bab8518 100644 --- a/abc042/b.c +++ b/abc042/b.c @@ -2,33 +2,33 @@ #include #include -int compare_strings(const void *string1, const void *string2); +int cmp_str(const void *str1, const void *str2); int main(void) { int i; - int number_strings; - int string_length; - char strings[100][100 + 1]; + int num; + int len; + char strs[100][100 + 1]; - scanf("%d %d", &number_strings, &string_length); + scanf("%d %d", &num, &len); i = 0; - while (i < number_strings) + while (i < num) { - scanf("%s", strings[i]); + scanf("%s", strs[i]); ++i; } - qsort(strings, number_strings, sizeof(strings[0]), compare_strings); + qsort(strs, num, sizeof(strs[0]), cmp_str); i = 0; - while (i < number_strings) + while (i < num) { - printf("%s", strings[i]); + printf("%s", strs[i]); ++i; } puts(""); } -int compare_strings(const void *string1, const void *string2) +int cmp_str(const void *str1, const void *str2) { - return (strcmp(string1, string2)); + return (strcmp(str1, str2)); }