avatar

PrintF/ScanF

Go Basics - Arrays vs Slices

With this article I have tried giving a brief overview of two fundamental data structures in the Go programming language: arrays and slices. This may help anyone coming from a dynamic language to Go and understand the basics of couple of most used data structures in all programs . Arrays Arrays are fundamental data structures in the Go programming language that allow you to store and manage collections of elements of the same type.

Go Basics - Pointers

In Go, a pointer is a variable that stores the memory address of another variable. We use the ampersand (&) operator to get the memory address of a variable, and the asterisk (*) operator to declare a pointer variable or to access the value pointed to by a pointer. In the example code provided, p is a pointer to the variable x. We can use the * operator to access the value stored in the memory location pointed to by p.