Go uses **T syntax for double pointers to allow functions to modify the address stored in a pointer variable.
Go does not support double pointers like C; you must use a pointer to a pointer (**T) to modify a pointer variable passed to a function. Use **T as the parameter type and dereference twice to assign a new address to the original pointer.
func updatePtr(ptr **int) {
*ptr = new(int)
**ptr = 42
}
func main() {
var p *int
updatePtr(&p)
fmt.Println(*p) // Output: 42
}
A double pointer is a variable that holds the address of another pointer. You use it when you need a function to change which address a pointer variable points to, rather than just changing the value at that address. Think of it as a mailman who needs to change the address on your mailbox label, not just the letter inside.