# 08.01-「\*」與「&」運算符號

在 Go 語言中，指標是使用星號字元「\*」表示，後面接著儲值的資料型別。在 `zero` 函式中， `xPtr` 是一個指向 `int` 型別的指標。

`*` 是用來提取（dereference）指標變數的值，提取一個指標可以存取指標所指向的內容值。當我們寫 `*xPtr = 0`，這表示我們將 `int` 型別的整數值 0 儲存在 `xPtr` 所參照的記憶體位置中。若我們試著改用 `xPtr = 0`，則我們在編譯程式時會發生錯誤，因為 `xPtr` 的型別不是 `int`，而是 `*int`，這個型別只能存入 `*int` 型別。

最後，我們使用 `&` 運算符來取得變數本身的位址，`&x` 會傳回一個 `*int` 型別（指向一個 int 整數），由於 `x` 的型別是 `int`，透過指標可以修改原本的變數內容。在 `main` 函式的 \&x 與在 `zero` 函式的  `xPtr`  都參照到相同的記憶體位址。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://go.netdpi.net/pointer/star_and.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
