예제 #1
0
/*
main
*/
int main(int argc, char* argv[]) {
	LINKEDLIST *self;
	PERSONALINFO *personInfo;

	CreateLinkedList(&self);

	AddPersonalInfo(&personInfo, "kim", "111", "seoul", FALSE);
	AppendLinkedList(&self, &personInfo);
	AddPersonalInfo(&personInfo, "lee", "222", "busan", FALSE);
	AppendLinkedList(&self, &personInfo);

	AddPersonalInfo(&personInfo, "park", "333", "inchon", FALSE);
	InsertLinkedList(&self, 2, &personInfo);

	DeleteLinkedList(&self, 3);
	//DeleteLinkedList(&self, 1);
	//DeleteLinkedList(&self, 1);

	personInfo = ViewAtLinkedList(&self, 2);
	printf("name : %s\nphone : %s\naddress : %s\nflag : %d\n", personInfo->name, personInfo->phone, personInfo->address, personInfo->flagOfDelete);

	DestroyLinkedList(&self);

	return 0;
}
예제 #2
0
void
main() {

        int dat;
        struct linkList *list1 = NULL;

        InsertLinkedList(&list1, 21, 1);         /*Insert node in Beginning */
        InsertLinkedList(&list1, 31, 2);         /*Insert at position 2 */
        InsertLinkedList(&list1, 41, 3);
        InsertLinkedList(&list1, 51, 4);
        InsertLinkedList(&list1, 61, 5);
        InsertLinkedList(&list1, 72, 6);
        InsertLinkedList(&list1, 87, 7);

        displayList(list1);

	printf ( "Mid node of list is %d\n", midNode(list1));
        displayList(list1);

}
예제 #3
0
void
main() {

        int dat;
        struct linkList *list1 = NULL, *list2 = NULL;

        InsertLinkedList(&list1, 21, 1);         /*Insert node in Beginning */
        InsertLinkedList(&list1, 31, 2);         /*Insert at position 2 */
        InsertLinkedList(&list1, 41, 3);
        InsertLinkedList(&list1, 51, 4);
        InsertLinkedList(&list1, 61, 5);
        InsertLinkedList(&list1, 72, 6);
        InsertLinkedList(&list1, 87, 7);

        InsertLinkedList(&list2, 91, 1);
        InsertLinkedList(&list2, 92, 2);
        InsertLinkedList(&list2, 93, 3);
        InsertLinkedList(&list2, 94, 4);
        displayList(list1);
        displayList(list2);

	/* build a Y list */
	list2->next->next->next->next = list1->next->next->next;
        displayList(list1);
        displayList(list2);

	printf ( "Intersecting node is %d\n", intersectNode(list1, list2, 7, 8));
}