编程 编程问题汇总 5月 22, 2023 112int* dist = malloc(sizeof(int) * graph->V);int* prev = malloc(sizeof(int) * graph->V); 报错从”void”到指向非”void”的指针的转换要求显式类型转换错误 因为malloc函数返回的是void类型指针,需要显式转换为int类型指针。可以将代码改为: 改为 12int* dist = (int*) malloc(sizeof(int) * graph->V);int* prev = (int*) malloc(sizeof(int) * graph->V);