Home > Back-end >  Turn to the storage structure of the tree
Turn to the storage structure of the tree

Time:02-20

What is the meaning of this sentence? Typedef struct node;
(drawn on a horizontal line)

CodePudding user response:

The tree is a node * type, suggest to look at the use of the typedef

CodePudding user response:

Is to declare a structure name node (typedef add don't add is ok), and to declare a function name, will be used later as node * but node haven't define
More common is, of course, write behind the structure definition, like
 
Typedef struct node_ {
Char data;
//...
} node, * tree;

PS: this usage with much, because the structure and function also is different, separate compilation can separate the function definitions with a statement, but not structure, because involves the offset, so unless wrong the pointer reference solution, otherwise. C must ensure that its definition is visible, this is also the reason of why the structure of the definition in a header file, in brief look at the line, this statement used to define a few first
  • Related