From 904adafee5b88242c9c9fb77e8f9e7b3d735127a Mon Sep 17 00:00:00 2001 From: Boukabouya Date: Sat, 30 Dec 2023 13:47:42 +0100 Subject: [PATCH] pointer --- hello/main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hello/main.go b/hello/main.go index 8ab932f..c595b6b 100644 --- a/hello/main.go +++ b/hello/main.go @@ -5,5 +5,16 @@ import ( ) func main() { - fmt.Println("Hello from Go!") + intPointer := 45.31 + // p is a pointer initialized with the address of intPointer + var p = &intPointer + fmt.Println("pointure", *p) + // p1 is a pointer to the address of intPointer + p1 := &intPointer + fmt.Println("pointure 2", *p1) + + *p1 = *p1 / 31 + fmt.Println("pointure 1:", *p1) + fmt.Println("pointure 2:", *p) + fmt.Println("value :", intPointer) }