DEV Community

loading...

Discussion on: Golang Linked List | Data Structure

Collapse
lemenendez profile image
leonidas menendez • Edited

Displaying the list but leaving the head as it is

func (l LinkedList) Display() {
n := l.head
for n != nil {
fmt.Printf("%v-->", n.data)
n = n.next
}
}