Pointers in Go programming language or Golang is a variable which is used to store the memory address of another variable. Pointers in Golang are also termed as the special variables. The variables are used to store some data at a particular memory address in the system. The memory address is always found in hexadecimal format(starting with 0x like 0xFFAAF etc.).
In pointers, you are allowed to find the length of the pointer with the help of len() function. This function is a built-in function returns the total number of elements present in the pointer to an array, even if the specified pointer is nil. This function is defined under builtin.
func len(l Type) int
Here, the type of l is a pointer. Let us discuss this concept with the help of given examples:
Length of ptr1: 6 Length of ptr2: 3 Length of ptr3: 4
Value of p = 200 Value of p = 300 Value of p = 400 Value of p = 500 Length of arr: 6 Length of p: 4
- How to find the Length of Channel, Pointer, Slice, String and Map in Golang?
- How to find the capacity of the pointer in Golang?
- How to find the capacity of Channel, Pointer and Slice in Golang?
- Program to find the Length of the longest substring without repeating characters in Golang
- Pointer to a Struct in Golang
- How to check pointer or interface is nil or not in Golang?
- Golang Pointer to an Array as Function Argument
- reflect.Pointer() Function in Golang with Examples
- How to declare and access pointer variable in Golang?
- How to instantiate Struct Pointer Address Operator in Golang?
- How to Copy Struct Type Using Value and Pointer Reference in Golang?
- Function that takes an interface type as value and pointer in Golang
- Go Pointer to Pointer (Double Pointer)
- How to Find the Sin and Cos Value of a Number in Golang?
- How to find the last index value of specified string in Golang?
- How to find the type of Struct in Golang?
- How to find the index value of specified string in Golang?
- Golang | How to find the index of rune in the string?
- Different Ways to Find the Type of Variable in Golang
- Different Ways to Find the Type of an Object in Golang
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.