promotion image of download ymail app
Promoted

C++刪除結點

http://codepad.org/qvb8gM4Z

請問原始碼裡這段code含義是啥嗎??

可否請這裡高手or 好心人說明一下

我看不懂這整大段的意思

void linklist::delBack()

{

link *tempPtr = lastPtr;

if (firstPtr == NULL)

return;

else {

if (firstPtr == lastPtr)

firstPtr = lastPtr = NULL;

else {

link *currentPtr = firstPtr;

while(currentPtr->next != lastPtr)

currentPtr = currentPtr->next;

lastPtr = currentPtr;

lastPtr->next = NULL;

}

}

delete tempPtr;

}

3 Answers

Rating
Still have questions? Get your answers by asking now.