你好,我有堆棧中的結構指針問題。C++,堆棧和結構指針
我有結構的堆棧:
stack<Somethink*> stack1;
,我想推,「Somethink」
void Search(Somethink* array_Somethink, int s, int d,) {
stack1.push(&(array_Somethink[s])); //
while (stack1.size() != 0) {
int i = 0;
array_Somethink[i] = *(stack1.pop()); // this return a error
i++;
}
}
我希望有人可以給我一個提示,如何正確地推的流行陣列從這個棧中彈出
謝謝:d
請發佈[MCVE],包括逐字錯誤消息。 –
[將std :: stack .pop()方法的結果存儲到變量中]的可能重複(http://stackoverflow.com/questions/12206242/store-results-of-stdstack-pop-method-into-a-變量) – MicroVirus