mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-16 11:02:09 +08:00
fix: Update C code for compatibility with the MSVC compiler (#949)
* Replace VLA with malloc Replace VLA with malloc to make C code compatible with cl compiler on Windows. * Fix C code for CI compiler. * Fix C code compability to CI. * check the trigger
This commit is contained in:
@@ -38,7 +38,7 @@ int *getMinHeap(MaxHeap *maxHeap) {
|
||||
int *topKHeap(int *nums, int sizeNums, int k) {
|
||||
// 初始化小顶堆
|
||||
// 请注意:我们将堆中所有元素取反,从而用大顶堆来模拟小顶堆
|
||||
int empty[0];
|
||||
int *empty = (int *)malloc(0);
|
||||
MaxHeap *maxHeap = newMaxHeap(empty, 0);
|
||||
// 将数组的前 k 个元素入堆
|
||||
for (int i = 0; i < k; i++) {
|
||||
|
||||
Reference in New Issue
Block a user