From 1d136a8f383e8a4f082b567390fd8d8a20abf088 Mon Sep 17 00:00:00 2001 From: yenru0 Date: Tue, 9 Apr 2024 14:13:32 +0900 Subject: [PATCH] complete 18870.c --- zeta_C/{ => completed}/18870.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) rename zeta_C/{ => completed}/18870.c (89%) diff --git a/zeta_C/18870.c b/zeta_C/completed/18870.c similarity index 89% rename from zeta_C/18870.c rename to zeta_C/completed/18870.c index 169a7e7..7b6aebb 100644 --- a/zeta_C/18870.c +++ b/zeta_C/completed/18870.c @@ -44,17 +44,14 @@ void compress(int N, Honeycomb *arr) { } qsort(arr, N, sizeof(Honeycomb), compare_loc); - return; } +// C11(Clang)에서 런타임에러: 백준 clang에서 qsort가 정렬을 제대로 하지 못하는 문제 int main() { int N; scanf("%d", &N); Honeycomb *arr;; - if ((arr = (Honeycomb *) calloc(N, sizeof(Honeycomb))) == NULL) { - printf("NULL"); - return 1; - } + arr = (Honeycomb *) calloc(N, sizeof(Honeycomb)); for (int i = 0; i < N; i++) { scanf("%d", &arr[i].x); arr[i].loc = i;