【发布时间】:2014-04-10 03:21:37
【问题描述】:
extractMin 的参数行出现以下错误:
randmst.c:129: 错误:在“&”标记之前需要“;”、“,”或“)”
如果我没有粘贴足够的代码以使错误变得明显,请告诉我。
//the heap functions
//based on p. 163 of clrs
VertexPointer
extractMin(VertexPointer *heap, int &heap_size){
VertexPointer max = heap[0];
(*heap[0]).key = 100;
heap_size = heap_size - 1;
minHeapify(heap, heap_size, 1);
return max;
}
【问题讨论】:
-
C 中没有引用。
-
&token表示变量的地址,函数参数要改成*heap_size[表示它保存了变量的地址]
标签: c pointers arguments ampersand