Пример #1
0
int main(void)
{
    Sqlist lc,ld,lb,la;
    int e,locale,pos,elem;
    init_list(&lc);
    CreateList(&lc);
    print(lc);
    printf("Please enter the elem your want to find:\n");
    scanf("%d",&e);
    locale = location(&lc, e);
    printf("the location of elem is %d\n",locale);
    printf("Please enter the insert position and the elem:\n");
    scanf("%d%d",&pos,&elem);
    List_Insert(&lc,pos,elem);
    printf("after insert elem ,the Sqlist is:\n");
    print(lc);


    printf("Please enter the insert position and the elem:\n");
    scanf("%d%d",&pos,&elem);
    List_Del(&lc,pos,elem);
    printf("after delete elem ,the Sqlist is:\n");
    print(lc);

    init_list(&ld);
    init_list(&la);
    CreateList(&la);
    init_list(&lb);
    CreateList(&lb);
    Combine(la,lb,&ld);
    print(ld);

    return 0;
}
Пример #2
0
static MV_INLINE List_Head* List_GetLast(List_Head *head)
{
	List_Head * one = NULL;
	if ( List_Empty(head) ) return NULL;

	one = head->prev;
	List_Del(one);
	return one;
}