隆重推荐2011最有前途和爆发力的股票 (转载)# Joke - 肚皮舞运动
b*y
1 楼
在delete head的时候,书上有两种写法
一是P27
bool deleteElement( IntElement **head, IntElement *deleteMe )
{
IntElement *elem = *head;
if( deleteMe == *head ){ /* special case for head */
*head = elem->next;
delete deleteMe;
return true;
}
}
第二种是 P37
bool remove( Element *elem ){
if (elem == head) {
head = elem->next;
delete elem;
return true;
}
...
那种方法是对的
一是P27
bool deleteElement( IntElement **head, IntElement *deleteMe )
{
IntElement *elem = *head;
if( deleteMe == *head ){ /* special case for head */
*head = elem->next;
delete deleteMe;
return true;
}
}
第二种是 P37
bool remove( Element *elem ){
if (elem == head) {
head = elem->next;
delete elem;
return true;
}
...
那种方法是对的