From a6fb6f3a26bc004c0ef688fece59cebc943acc2f Mon Sep 17 00:00:00 2001 From: zavre-c <52506927+zavre-c@users.noreply.github.com> Date: Tue, 24 Mar 2020 18:31:35 +0530 Subject: [PATCH 1/2] Added new() to get pointer Added function implementation of new() for getting a pointer. --- go.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/go.md b/go.md index 74c7a969b..600b36f40 100644 --- a/go.md +++ b/go.md @@ -135,6 +135,11 @@ func getPointer () (myPointer *int) { } ``` {: data-line="3"} +```go +a := new(int) +*a = 234 +``` +{: data-line="4"} Pointers point to a memory location of a variable. Go is fully garbage-collected. From 517343fcd991e6d3d98b3c4e20614bc567710ad1 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Sat, 13 Jun 2020 10:17:21 +1000 Subject: [PATCH 2/2] Update go.md --- go.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go.md b/go.md index 600b36f40..c88b50851 100644 --- a/go.md +++ b/go.md @@ -135,11 +135,12 @@ func getPointer () (myPointer *int) { } ``` {: data-line="3"} + ```go a := new(int) *a = 234 ``` -{: data-line="4"} +{: data-line="2"} Pointers point to a memory location of a variable. Go is fully garbage-collected.