March 2019
Intermediate to advanced
336 pages
9h 9m
English
The AddtoHead method adds the node to the head of the unordered list. The AddToHead method of the UnOrderedList class has a property parameter that's an integer. It will make the headNode point to a new node created with property, and the nextNode points to the current headNode of the unordered list:
//AddToHead method of UnOrderedList classfunc (UnOrderedList *UnOrderedList) AddToHead(property int) { var node = &Node{} node.property = property node.nextNode = nil if UnOrderedList.headNode != nil { node.nextNode = UnOrderedList.headNode } UnOrderedList.headNode = node}
Read now
Unlock full access