Add struct, method, construct, composition

This commit is contained in:
Archie Fox
2025-03-04 00:55:21 +03:00
parent 850430b62e
commit 13868f6a8a
2 changed files with 116 additions and 10 deletions

View File

@@ -0,0 +1,20 @@
package main
import (
"fmt"
)
func main() {
a := [4]int{1, 2, 3, 4}
reverse(&a)
fmt.Println(a)
// var n *int
// fmt.Println(*n)
}
func reverse(arr *[4]int) {
for idx, val := range *arr {
(*arr)[len(arr)-1-idx] = val
}
}