-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinkedlistcustomer.go
64 lines (51 loc) · 947 Bytes
/
linkedlistcustomer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"fmt"
)
type text string
type Customer struct {
firstname, lastname text
age uint8
birth uint16
workplace text
next *Customer
}
func printList(user *Customer) {
for user != nil {
fmt.Printf(
"%-10s| %-10s| %-4d| %-5d| %-10s\n",
user.firstname,
user.lastname,
user.age,
user.birth,
user.workplace,
)
user = user.next
}
}
func main() {
var first Customer = Customer{
firstname: "Asadbek",
lastname: "Ergashev",
age: 21,
birth: 2000,
workplace: "Najot Talim",
}
var second Customer = Customer{
firstname: "Najim",
lastname: "Sobirov",
age: 23,
birth: 1998,
workplace: "PDP",
}
var third Customer = Customer{
firstname: "Oybek",
lastname: "Akmalov",
age: 18,
birth: 2003,
workplace: "School",
}
first.next = &second
second.next = &third
printList(&first)
}