Talk C Chestnut Bar (13th time: C-language example-single-linked list II)

Source: Internet
Author: User


Crossing, everyone, from today onwards, we talk about the large-scale couplet science fiction: C Chestnut, that is, C language examples. Gossip Hugh,

Words return to the positive turn. Let's talk C chestnuts together!


Crossing, the last time we talked about the list and the single-linked list of sequential storage examples, this time we continue to say the single-linked list of examples, not

This time we're talking about single-chain table storage.


Crossing chain storage of single-linked lists, we have said in the last time that there is no more to say here. The main example of this is to

Describes what is chained storage for single-linked lists.


This can be seen by comparing the sequential storage and chained storage of a single-linked list.

The advantages of sequential storage chain list: It is convenient to traverse the linked list and find it conveniently.

the disadvantage of sequential storage list: Delete, insert element is more cumbersome.

Advantages of chained storage lists: Inserting, deleting elements is convenient. Traverse and find more complex

The disadvantage of chained storage lists: traversal and lookup elements are more complex.

In general, chain-store linked list is used more in the actual development, because it is more flexible, and the size of the list can be based on the need to move

With high space utilization.


Crossing, the text does not write code, the detailed code put in my resources, you can click the link to download the use. About the code has

The following points need attention:

1. When creating a linked list in code, use the head node, which makes the list easier to operate. For detailed reasons, you can see the comments in the code.

2. The code has a DEBGU statement, in the code if you define a debug macro, you can print some debug statements, so that you can

Quickly find the cause of the problem. If you do not need debug to define this macro, the macro is not defined by default.

3. The code uses a level two pointer, which is especially careful when used.


You crossing, for example, on single-chain-link storage We're going to talk about this. I want to know what the following example, and listen to tell.

Talk C Chestnut Bar (13th time: C-language example-single-linked list II)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.