What's the point of having pointers in Go?

前端 未结 4 428
长情又很酷
长情又很酷 2020-12-12 15:45

I know that pointers in Go allow mutation of a function\'s arguments, but wouldn\'t it have been simpler if they adopted just references (with appropriate const or mutable q

4条回答
  •  一整个雨季
    2020-12-12 16:38

    References cannot be reassigned, while pointers can. This alone makes pointers useful in many situations where references could not be used.

提交回复
热议问题