Home > Back-end >  C structure
C structure

Time:02-11

Struct DLinkedNode {
Int the key and the value;
Prev DLinkedNode *;
DLinkedNode * next;
DLinkedNode: key (0), value (0), prev (nullptr), prev (nullptr)
DLinkedNode (int _key int_value) : the key (_key), value (_value), prev (nullptr), next (nullptr) {}
}
Excuse me, in the above code:
DLinkedNode: key (0), value (0), prev (nullptr), prev (nullptr)
DLinkedNode (int _key int_value) : the key (_key), value (_value), prev (nullptr), next (nullptr) {}

What is the meaning of these two lines, the first line is initialized, if the first row is initialized, the second line is unknown what do you mean,
Baidu baidu not to, also does not have the c + + book at hand, I ask you, thank you very much

CodePudding user response:

The first line is wrong? DLinkedNode () ://fewer parenthesis, isn't it? This is the constructor; : is behind for the member variable assignment; {} is a function of the constructor, if it's not the key (0) initialization, this way can also be realized in {} to add code, such as {key=0; }
Baidu don't come out may be your keyword is wrong, you baidu the constructor, member is initialized, it should have
  • Related