Skip to content

Instantly share code, notes, and snippets.

@AahanSingh
Created June 27, 2021 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AahanSingh/19f484147ab07007fec5223309291e59 to your computer and use it in GitHub Desktop.
Save AahanSingh/19f484147ab07007fec5223309291e59 to your computer and use it in GitHub Desktop.
Deleting the entire linked list
// DeleteList will delete the entire linkedlist.
// Deletion is inplace
func DeleteList(head **Node) {
fmt.Println("\nDeleting entire linkedlist")
var aux *Node
for (*head) != nil {
aux = (*head).Next
*head = nil
*head = aux
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment