> For the complete documentation index, see [llms.txt](https://beej-c-zhtw.netdpi.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://beej-c-zhtw.netdpi.net/3.-bian-shu-yu-chen-shu-shi/3.1.-bian-shu.md).

# 3.1. 變數

可以說「變數存值」，但另一種思考角度，變數是人類可讀的名稱，而它代表記憶體中的某些資料。

我們要花一點時間，從兔子洞裡窺一眼，這個洞是指標。別擔心。

您可以將記憶體視為一個大型的位元組（bytes）陣列\[32]。資料儲存在此「陣列」\[33]中。如果數字大於一個位元組，則以多個位元組來儲存。由於記憶體就像陣列，記憶體的每個位元組都可以由其索引來參照。記憶體中的這個索引也稱為位址、位置或指標。

當您在C中有變數時，該變數的值會存在記憶體中的某個位置、某個位址。（不然它還能在哪裡呢？）但是用數值位址來表示一個值是很困難的，所以我們為它取了一個名稱，這就是變數名稱。

我提出這一切的原因有兩個：

這將使以後更易於理解指標變數 — 它們是包含其他變數地址的變數！ 而且，它也會讓以後更容易理解指標。 所以變數是一些資料的名稱，這些資料儲存在記憶體的某個位置上。

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://beej-c-zhtw.netdpi.net/3.-bian-shu-yu-chen-shu-shi/3.1.-bian-shu.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.
