New answers tagged

2

in function: void init_queue(struct priority_queue **pq, size_t capacity) after the final closing brace '}' there is a semicolon ';'. This results in the compiler outputting: untitled1.c:41:2: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic] There are also some warnings about implicit conversions. When compiling, always enable ...


4

Avoid double pointers. They are absolutely unwarranted in all the functions (except init, but see below). Prefer returning a value to a side effect. In the client code, which I presume is along the lines of struct priority_queue * pq; init_queue(&pq, capacity); I have to read the source of init_queue to see that there is a side effect of modifying ...


Top 50 recent answers are included