dll_ins2.c
来自「与C语言四书五经之《C和指针》的配套的书上源代码。」· C语言 代码 · 共 34 行
C
34 行
/*
** Add the new node to the list.
*/
if( next != NULL ){
/*
** Case 1 or 2: not at end of the list
*/
newnode->fwd = next;
if( this != rootp ){ /* Case 1: not at front */
this->fwd = newnode;
newnode->bwd = this;
}
else { /* Case 2: at front */
rootp->fwd = newnode;
newnode->bwd = NULL;
}
next->bwd = newnode;
}
else {
/*
** Case 3 or 4: at end of the list
*/
newnode->fwd = NULL;
if( this != rootp ){ /* Case 3: not at front */
this->fwd = newnode;
newnode->bwd = this;
}
else { /* Case 4: at front */
rootp->fwd = newnode;
newnode->bwd = NULL;
}
rootp->bwd = newnode;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?