tyepdef struct LNode* List; ==> typedef struct a* b; What does this sentence mean?

First of all, int* p; This statement can be understood as int* is a new data type.

To give a similar example, pointers to integers are generally used in this way: int p; //p is a pointer to an integer. If we used typedef int Pint; before, the above method can be changed to: Pint p; also declares a pointer to an integer.

In this way, typedef struct {...}* Pstr; is not difficult to understand, Pstr List; just declares a pointer to the structure of struct{...}. But at this time, List is a dangling pointer, and in this case, data cannot be allocated statically, so a space can be dynamically allocated to let List point to. C++ can do this: p=new* NList; If there is no new statement, you can also write: List=(Pstr)malloc(sizeof(* p));

Reference http://bbs.elecfans.com/jishu_1573819_1_1.html

Guess you like

Origin blog.csdn.net/cwindyc/article/details/105870501