연결 리스트(Linked List)

 

■ 연결 리스트(Linked List)

[ 삽입 함수 ] ---> 연결 리스트의 노드 삽입

void insert(int  x, LIST L, position p)
{
    position tmp_cell;
    tmp_cell = (position) malloc(sizeof(struct node));
    {
        tmp_cell->element = x;             /* ① */
        tmp_cell->next = p->next;        /* ② */
        p->next = tmp_cell;                  /* ③ */
    }
}