Record Detail

Compile Error

prepare (1/3): 
finished

make (2/3): 
gcc -std=gnu11 -O0 -g -Wall -Wextra -Werror -pedantic -Wno-unused-result -Wconversion -o main main.c
main.c: In function 'initializer':
main.c:14:42: error: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Werror=sign-conversion]
     a->parent = (int*)malloc(sizeof(int) * n);
                                          ^
main.c: In function 'kruskal':
main.c:74:15: error: conversion to 'size_t {aka long unsigned int}' from 'int' may change the sign of the result [-Werror=sign-conversion]
     qsort(es, M, sizeof(Edge), cmp_w);
               ^
main.c:75:44: error: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Werror=sign-conversion]
     Edge* ans = (Edge*)malloc(sizeof(Edge) * M);
                                            ^
main.c:86:16: error: conversion to 'size_t {aka long unsigned int}' from 'int' may change the sign of the result [-Werror=sign-conversion]
     qsort(ans, cnt, sizeof(Edge), cmp_uv);
                ^~~
main.c: In function 'prim':
main.c:95:42: error: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Werror=sign-conversion]
     int* vnew = (int*)malloc(sizeof(int) * N);
                                          ^
main.c:100:44: error: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Werror=sign-conversion]
     Edge* ans = (Edge*)malloc(sizeof(Edge) * M);
                                            ^
main.c:115:16: error: conversion to 'size_t {aka long unsigned int}' from 'int' may change the sign of the result [-Werror=sign-conversion]
     qsort(ans, cnt, sizeof(Edge), cmp_uv);
                ^~~
main.c: In function 'main':
main.c:127:43: error: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Werror=sign-conversion]
     Edge* es = (Edge*)malloc(sizeof(Edge) * M);
                                           ^
cc1: all warnings being treated as errors
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1

build failed

Information

Submit By
Type
Submission
Homework
l2-c
Language
GNU Make
Submit At
2023-10-15 16:16:47
Judged At
2023-10-15 16:16:47
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes