push all exercices
This commit is contained in:
BIN
ch6/3/ch6_3.exe
Normal file
BIN
ch6/3/ch6_3.exe
Normal file
Binary file not shown.
20
ch6/3/ch6_3.go
Normal file
20
ch6/3/ch6_3.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Person struct {
|
||||
name string
|
||||
age int
|
||||
}
|
||||
|
||||
func MakePerson(name string, age int) Person {
|
||||
return Person{name, age}
|
||||
}
|
||||
|
||||
func main() {
|
||||
personSlice := make([]Person, 0, 512)
|
||||
for i := 0; i < 10_000_000; i++ {
|
||||
personSlice = append(personSlice, MakePerson("aaa", i))
|
||||
}
|
||||
fmt.Println(personSlice[:100])
|
||||
}
|
||||
3
ch6/3/go.mod
Normal file
3
ch6/3/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module ch6_3
|
||||
|
||||
go 1.25.0
|
||||
Reference in New Issue
Block a user