A few words before we start. You can find the code used in this tutorial in this repository. You can find the full contents of Road to Go Pro here. If you missed the last one, you can find it via this link.
A few words before we start. You can find the code used in this tutorial in this [repository_](https://github.com/songx23/RoadToGoPro). You can find the full contents of Road to Go Pro [here_](https://medium.com/@songx/road-to-go-pro-f9d1f8a51fad). If you missed the last one, you can find it via this [link_](https://levelup.gitconnected.com/road-to-go-pro-flow-control-dfcc7b9a5395)._
We talked about flow controls and loops in the last part of the tutorial. In this one, we will cover pointers and functions. After finishing the first 4 parts of Road to Go Pro, you are well equipped to start writing scripts or console applications using Go.
In short, a pointer holds the underlying memory address of a value. Whoa, hold on, memory address? Isn’t Go a high-level programming language?
When do we even need to know about the memory addresses of variables?
That’s a good question but before exploring the answer, we need to take a quick detour. Let’s see how to declare pointers and how to use them in functions. Once we have covered these, it will be easier for you to understand the reasoning and examples below. So hang in there.
Whenever we declare a variable in Go, the compiler allocates a segment of memory to store it. The value of that variable is stored there until it is recycled by the garbage collector.
Pointers are composite data types. We form a pointer type by adding an
* in front of the data type it points to. For instance,
*string represents the type of a pointer pointing to a string-type variable.
To get the pointer value of an existing variable, we need to add an
& in front of the variable.
Hire dedicated GoLang developers from WebClues Infotech to build applications using Go language. Get best GoLang developers for your web development projects.
Golang Web Development is the new trend globally. Get all the details about the Golang development here. Hire Golang Developers.
Binmile is a frontline Golang web development company offering Golang development solutions by experienced and professional web developers.
In this Go tutorial we'll walk trough a simple Go file to explain the basics of how Go files & programs work.
In this video I wanted to cover something different. I've been looking into Golang and I believe its a language that many people will adopt in the future. Its simple, fast and has an amazing ability to handle tasks concurrently. I plan on making on videos with Golang as I don't see much content out therefore go and I think this is a language people want to learn and I want to help with that.