---
title: "Discussion on \"Pointers In Golang\" | Hashnode"
description: "Discussion on \"Pointers In Golang\". Pointers in Go are variables that store the memory address of another variable. They are denoted by the * symbol preceding the type of variable they will point to. For example, to declare a pointer to an integer variable, you would write var ptr *int..."
url: "https://hashnode.com/posts/pointers-in-golang/6444136161370244d7fbe53a"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Pointers In Golang](https://gauravshukla.hashnode.dev/pointers-in-golang?utm_source=hashnode&utm_medium=feed)

Pointers in Go are variables that store the memory address of another variable. They are denoted by the \* symbol preceding the type of variable they will point to. For example, to declare a pointer to an integer variable, you would write var ptr \*int...

Apr 22, 2023 · 2 min read · gauravshukla.hashnode.dev  
Read the article

-   [#wemakedevs](https://hashnode.com/tag/wemakedevs)
-   [#golang](https://hashnode.com/tag/golang)
-   [#pointers](https://hashnode.com/tag/pointers)
-   [#hashnode](https://hashnode.com/tag/hashnode)
-   [#devops](https://hashnode.com/tag/devops)

## Written by

[Gaurav Shukla](https://hashnode.com/@withgauravv)

@withgauravv · India

  
[View profile](https://hashnode.com/@withgauravv)

web developer

## Responses 2

Markdown supported · ⌘↵ to post

[Gemma Black](https://hashnode.com/@GemmaBlack)

[Apr 23, 2023](https://hashnode.com/posts/pointers-in-golang/6444136161370244d7fbe53a/comment/644564caea9c083a86dcdb68)

I haven't started with Go yet so this was helpful.

Would this remove the pointer/reference then from the `ptr` variable to `x`...

```
ptr = 21
```

... when the star syntax is not used?

[Gaurav Shukla](https://hashnode.com/@withgauravv)

[Apr 25, 2023](https://hashnode.com/posts/pointers-in-golang/6444136161370244d7fbe53a/comment/644564caea9c083a86dcdb68#reply-64482e21e947fa5fa90b27fc)

I haven't seen your reply coz I was busy. No, assigning a value to a pointer variable in Go without using the dereferencing operator `*` only changes the value of the pointer itself, not the value pointed to by the pointer. To change the value of the pointed-to variable, you need to dereference the pointer using the `*` operator.

[Gemma Black](https://hashnode.com/@GemmaBlack)

[Apr 25, 2023](https://hashnode.com/posts/pointers-in-golang/6444136161370244d7fbe53a/comment/644564caea9c083a86dcdb68#reply-6448366f73f3c95ec8ed712f)

No worries and thanks [Gaurav Shukla](https://hashnode.com/@withgauravv). I like to read these articles on my phone sometimes and I could have just tested it on a computer. But thank you for the explanation and theory.

[Gaurav Shukla](https://hashnode.com/@withgauravv)

[Apr 25, 2023](https://hashnode.com/posts/pointers-in-golang/6444136161370244d7fbe53a/comment/644564caea9c083a86dcdb68#reply-644846ab73f3c95ec8ed727e)

Anytime! I am happy to help you.

[Sarika Kushwaha](https://hashnode.com/@sarika22)

[Apr 22, 2023](https://hashnode.com/posts/pointers-in-golang/6444136161370244d7fbe53a/comment/64441a7ff0bb29340d3ef674)

nice💫
