# const 修飾詞

const int val1=100, val2=50;

const int \*ptr=\&val1;

ptr=\&val2; (OK)

在這裡，ptr 是一個指向 const interger 的指標，ptr 是可以改變的， 但是 ptr 所指向的 integer 那個變數本身是不可以改變的 (const)。

int val1=100, val2=50; int const \*ptr=\&val1;

ptr=\&val2; (Error)

ptr 是指向 integer 的指標，ptr 所指的位置是不可改變的， 然而，ptr 所指向的 integer 變數內容是可改變的。


---

# 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://applezu.netdpi.net/linux-prog/const-keyword.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.
