mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-14 12:40:58 +00: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:
@@ -36,7 +36,7 @@ int main() {
|
||||
preOrder(root);
|
||||
|
||||
printf("\n输出所有值为 7 的节点\n");
|
||||
int vals[resSize];
|
||||
int *vals = malloc(resSize * sizeof(int));
|
||||
for (int i = 0; i < resSize; i++) {
|
||||
vals[i] = res[i]->val;
|
||||
}
|
||||
@@ -44,5 +44,6 @@ int main() {
|
||||
|
||||
// 释放内存
|
||||
freeMemoryTree(root);
|
||||
free(vals);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user