Added new() to get pointer

Added function implementation of new() for getting a pointer.
This commit is contained in:
zavre-c 2020-03-24 18:31:35 +05:30 committed by GitHub
parent 447de944e4
commit a6fb6f3a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

5
go.md
View File

@ -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.