Typedef and custom struct types.

Source: Internet
Author: User

Typedef and custom struct types.

The typedef keyword is used for customizing struct types. we all know that typedef refers to an alias. const, # define, and so on are easily obfuscated in C. The difference is not discussed in this article.

/* Define the node type of a single-chain table */
Typedef char ElemType;
Typedef struct dNode {// declare the node type of a single-chain table
ElemType data;
Struct dNode * next; // pointer field} LNode, * LinkList;
// Define the struct variable struct dNode a or LNode; the pointer struct dNode * p, LNode * p, or LinkList p defining this struct is no different./* Insert a new node at the end of the linked list and create a linked list */

Note:

Sorry, I have too many comments on the Code. Beginners just want to take notes. Please forgive me.

Foreign Words:

1. thanks to the author of <300 questions that must be known in C Language>, the problems involved in this article are described in detail on pages 222nd and 223,227 (293. if you have any questions, you can check the book again. In addition, the book has a PDF version.

2. The author of this article has the following questions. Please help me with this blog. I am very grateful for this question:

  • Can the nodes of a single-chain table be of different types? For example, node 1 is written as 73, and node 2 is written as e.
  • Can the node be a string? How can we define it? It seems that C does not have a string type variable. Which identifier should I use.
  • (See note) I want to call this single-chain table in the future, but it is just a matter-type table. How can I define it as a matter-type table or an integer table, note that this problem is different from the first one.

3. I used this editor for the first time. This is not a habit. Is it a pitfall for the editor to automatically save the post? What is the restoration content starting to end. I tried to repeat a large part of the article at the beginning. and how can I copy two of my code blocks? How can I delete them.

Related Article

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.