Pointers in Golang

What’s a pointer ?

In Go , A pointer is a variable whose value is a memory address.

A pointer is defined using the ampersand operator.

Following a Pointer

In order to access ie following the pointer value , Go uses the asterisk operator.

Why is it needed ?

Pointers are very useful in Go because they allow the programmer to choose between passing a value and passing a reference

Key takeaways

  1. A pointer is a variable whose value is a memory address
  2. Pointers are defined using ampersand , address operator
  3. Pointers are followed using asterisk operator
  4. You can point at pointers
  5. Go does not support pointer arithmetic to prevent memory address manipulation
  6. Pointers are useful when choosing passing by value or by reference

https://github.com/ABISHEIKH/PointersInGolang.git

--

--

--

Golang Engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Your First Unit Tests: Write IOS Unit Unit the easy way

AWS Data Exchange for APIs, How to Protect Your APIs, APIs Aren’t Just for Developers

Groovy Script and Jenkins

Announcing Subskribe Series A

Hero image

Writing a Linux Kernel Module

On Documentation -more ‘jazz’

That feeling when you know you’re talking, and nobody’s listening :))

Google Certified Professional Cloud Developer 2021 — Exam guide mapping

Linked Lists for the Junior Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abdi Ismail

Abdi Ismail

Golang Engineer

More from Medium

Learn Go: Interfaces

Gorutin: go concurrency using generics

Tutorial: Building a Golang application Docker image

How Go Answers Node’s Pitfalls