#include#include typedef struct DNode{ int data; struct DNode * next,*prior; }DNode, * DlinkList; bool InitiList(DlinkList &L){ L= (DNode*)malloc(sizeof(DNode)); if(L==NULL) return false; L->next=NULL; L->prior=NULL; return true; } //在p结点之后插入s bool InsertList(DNode* p, DNode* s){ //为什么有的地方需要linkList &L 而这里是*p if(p==NULL||s==NULL) return false; s->next = p->next; if(p->next!=NULL) p->next->prior = s;//如果是最后一个节点,p->next=NULL没有东西,就会出错 s->prior = p; p->next = s; return true; } //在p之后删除节点s bool DeletList(DNode* p, DNode* s){ p->next = s->next; if(s->next!=NULL) s->next->prior = p; //s是最后一个元素怎么办 free(s); return true; } void swap(int* a, int* b) { int c=0; c=*a; *a=*b; *b=c; } void main(void){ int x=1,y=2; int* a = &x; int* b = &y; swap(&x,&y); printf("%d%d%0x",x,y,a); }



