Added new() to get pointer
Added function implementation of new() for getting a pointer.
This commit is contained in:
parent
447de944e4
commit
a6fb6f3a26
5
go.md
5
go.md
|
@ -135,6 +135,11 @@ func getPointer () (myPointer *int) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
{: data-line="3"}
|
{: 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.
|
Pointers point to a memory location of a variable. Go is fully garbage-collected.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue