在试图将一个称为“新诺德”的职能称为“推动阵线”的职能时,人们本应通过两个参数,但不知道它想要通过什么。 在试图说明这一点后,没有任何工作。 该守则是:
struct SingleLinkedListNode {
int value; //Integer value of the node
SingleLinkedListNode* next = 0; //Pointer to the next node in the list
//Next pointer is initialized to NULL
};
struct SingleLinkedList {
SingleLinkedListNode* head = 0; //Pointer to the beginning of the list
SingleLinkedListNode* tail = 0; //Pointer to the end of the list
int size = 0; //Counts the number of nodes in the list
};
SingleLinkedListNode* createNewNode(const int value, SingleLinkedListNode* next) {
SingleLinkedListNode* n = new SingleLinkedListNode;
n -> value = value;
n -> next = next;
return n;
}
void pushFront(SingleLinkedList& list, const int value) {
//id the list is empty
if (list.head == NULL) {
n = createNewNode(value, //I dont know);
list.head -> n;
n -> list.tail;
}
//else there is already a nod in the list
else {
n = createNewNode(value,);
list.head -> n;
n -> next
}
}