fix print
This commit is contained in:
parent
29574378a6
commit
e3988296dd
@ -3,10 +3,7 @@
|
|||||||
// Author: dlfld (2441086385@qq.com)
|
// Author: dlfld (2441086385@qq.com)
|
||||||
package chapter_array_and_linkedlist
|
package chapter_array_and_linkedlist
|
||||||
|
|
||||||
import (
|
import "testing"
|
||||||
"fmt"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
/* Driver Code */
|
/* Driver Code */
|
||||||
func TestLinkedList(t *testing.T) {
|
func TestLinkedList(t *testing.T) {
|
||||||
@ -23,8 +20,5 @@ func TestLinkedList(t *testing.T) {
|
|||||||
n2.Next = n3
|
n2.Next = n3
|
||||||
n3.Next = n4
|
n3.Next = n4
|
||||||
|
|
||||||
for n0 != nil{
|
PrintLinkedList(n0)
|
||||||
fmt.Printf("%v ",n0.Val)
|
|
||||||
n0 = n0.Next
|
|
||||||
}
|
|
||||||
}
|
}
|
14
codes/go/chapter_array_and_linkedlist/print_utils.go
Normal file
14
codes/go/chapter_array_and_linkedlist/print_utils.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// File: print_utils.go
|
||||||
|
// Created Time: 2022-12-24
|
||||||
|
// Author: dlfld (2441086385@qq.com)
|
||||||
|
|
||||||
|
package chapter_array_and_linkedlist
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func PrintLinkedList(head *ListNode){
|
||||||
|
for head != nil{
|
||||||
|
fmt.Printf("%v ",head.Val)
|
||||||
|
head = head.Next
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user