mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 18:11:38 +00:00
Update go.html.markdown (#4284)
This commit is contained in:
parent
da18f5c914
commit
ac212cb879
@ -179,7 +179,7 @@ func learnNamedReturns(x, y int) (z int) {
|
|||||||
|
|
||||||
// Go is fully garbage collected. It has pointers but no pointer arithmetic.
|
// Go is fully garbage collected. It has pointers but no pointer arithmetic.
|
||||||
// You can make a mistake with a nil pointer, but not by incrementing a pointer.
|
// You can make a mistake with a nil pointer, but not by incrementing a pointer.
|
||||||
// Unlike in C/Cpp taking and returning an address of a local varible is also safe.
|
// Unlike in C/Cpp taking and returning an address of a local variable is also safe.
|
||||||
func learnMemory() (p, q *int) {
|
func learnMemory() (p, q *int) {
|
||||||
// Named return values p and q have type pointer to int.
|
// Named return values p and q have type pointer to int.
|
||||||
p = new(int) // Built-in function new allocates memory.
|
p = new(int) // Built-in function new allocates memory.
|
||||||
|
Loading…
Reference in New Issue
Block a user