Home>Article>Backend Development> What does node mean in C language?
In C language, node is the name used to define the node of the linked list. It is usually used as the type name of the node in the data structure. The syntax is "struct Node{...};"; the structure and After the class has a name defined, the object can be defined directly using the name. There are also "Node * a" and "Node* & a" in the C language.
#The operating environment of this article: Windows 10 system, C18, Dell G3 computer.
Node is not a statement (not a keyword), it is just a name commonly used by programmers to define linked list nodes.
It Usually used as the type name of a node in a data structure.
Specific usage:
struct Node{ ... };
Of course, there are also cases where classes are used to define them (there are no classes in C language).
After defining the name of the structure and class, you can directly use this name to define the object.
Extended information:
There is Node * a in C language, and Node* &a
Usage
void initNode(Node* &a){ a = (Node*)malloc(sizeof(Node)); a->lenght=0; }
It means that the pointer variable in main is equivalent to the pointer variable in initNode. They are the same pointer.
There is another misunderstanding about the array int a[10];
void initArray(int a[]){ a = {1,2,3,4,5,6,7}; }
a is the first address of the array, it is a constant. What you want to do here is to change the address of a. Yes, how can constants be changed? . . . Just like 1 cannot recommend learning for 2
The above is the detailed content of What does node mean in C language?. For more information, please follow other related articles on the PHP Chinese website!