Bug fixes to C code.

This commit is contained in:
krahets
2023-11-01 05:14:22 +08:00
parent f7dd05e7a4
commit 355cc3a6b1
31 changed files with 246 additions and 219 deletions

View File

@@ -28,6 +28,11 @@ GraphAdjMat *newGraphAdjMat() {
return graph;
}
/* 析构函数 */
void delGraphAdjMat(GraphAdjMat *graph) {
free(graph);
}
/* 添加顶点 */
void addVertex(GraphAdjMat *graph, int val) {
if (graph->size == MAX_SIZE) {
@@ -139,7 +144,7 @@ int main() {
printGraphAdjMat(graph);
// 释放内存
free(graph);
delGraphAdjMat(graph);
return 0;
}