How to implement a linked list in C?

后端 未结 14 889
予麋鹿
予麋鹿 2020-12-06 02:49

I am creating a linked list as in the previous question I asked. I have found that the best way to develop the linked list is to have the head and tail in another structure.

14条回答
  •  半阙折子戏
    2020-12-06 03:32

    I think u first need to Imagin back-end. Code are nothing to important. Go here and visualize back-end basic c code of all insertion. 1) Insertion at beginning Visit and scroll to get every instruction execution on back- end And u need front and imagin Go here Back end imagin

    And All other possible insertion here.

    And important thing u can use this way.

    struct Node{
    int data;//data field
    struct Node*next;//pointer field
    };
    

    struct Node*head,*tail; // try this way

    or short cut

    struct Node{
    int data;//data field
    struct Node*next;//pointer field
    }*head,*tail; //global root pointer
    

    And

    << Click >> To visualize other linked list problem.

    Thanks.

提交回复
热议问题