Home > Back-end >  Initialization singly linked list and insert element operation error
Initialization singly linked list and insert element operation error

Time:10-07

Initialize the singly linked list and insert element, the first singly linked lists can perform the above operations correctly, but the second singly linked list implementation is not correct, this is how to return a responsibility?

CodePudding user response:

Is an error in the Display function printf, read access conflicts

CodePudding user response:

How the old people always make wrong, change parameter function pointer points to does not affect the function of the external argument point to
Initlist (LinkList * L) is L=malloc application memory here, with the main L1 and L2 don't have any relationship between MAO
Or to use reference initlist (LinkList * & amp; L), the main of L1 and L2 to pointer LinkList * L1, * L2; Intilist (L); Other unchanged
Or with double pointer initlist (LinkList& * * L) main L1 and L2 will change to a pointer, to use * L=initlist malloc


  • Related