Add pointer and password app
This commit is contained in:
15
go-demo-4/pointers/main.go
Normal file
15
go-demo-4/pointers/main.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package pointers
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
a := 5
|
||||
pointerA := &a
|
||||
double(&a)
|
||||
fmt.Println(*pointerA) // Дереференс (разыменование) указателя
|
||||
fmt.Println(a)
|
||||
}
|
||||
|
||||
func double(num *int) {
|
||||
*num = *num * 2
|
||||
}
|
||||
Reference in New Issue
Block a user