标签:amp struct next UNC .com imp nbsp pac lis
原文地址:http://www.niu12.com/article/47
package main
import "fmt"
type ListNode struct {
Value int
Next *ListNode
}
func main() {
one := makeListNode([]int{1, 2, 3})
for one != nil {
fmt.Println(one.Value)
one = one.Next
}
}
func makeListNode(nums []int) *ListNode {
if len(nums) == 0{
return nil
}
res := &ListNode{
Value:nums[0],
}
temp := res
for i := 1; i < len(nums); i++ {
temp.Next = &ListNode{Value:nums[i],}
temp = temp.Next
}
return res
}
标签:amp struct next UNC .com imp nbsp pac lis
原文地址:https://www.cnblogs.com/zhouqi666/p/9940026.html