> For the complete documentation index, see [llms.txt](https://docs.1l.lol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.1l.lol/basics/identifiers.md).

# 标识符、关键字与变量

### 标识符

标识符是程序员给变量、函数等起的名字，命名规则：

* 只能由**字母、数字、下划线**组成
* **不能以数字开头**
* **不能是关键字**
* **区分大小写**（`sum` 与 `Sum` 不同）

推荐：见名知义，如 `maxScore`；常量用全大写如 `MAXN`。

### 关键字

关键字是 C++ 语言保留、有特殊含义的单词，不能当作标识符，如： `int`、`double`、`char`、`bool`、`if`、`else`、`for`、`while`、`return`、`const`、`break`、`continue` 等。

### 常量与变量

* **变量**：值可以改变，使用前要先定义类型，如 `int a;`
* **常量**：值不能改变，用 `const` 定义，如 `const double PI = 3.14;`

```cpp
#include <iostream>
using namespace std;

int main() {
    int age = 12;          // 定义并初始化
    age = 13;              // 修改
    const int MAXN = 100;  // 常量，之后不可修改

    int a, b = 5;          // a 未初始化（值不确定），b = 5
    a = b + 1;
    cout << a << " " << age << " " << MAXN << endl;
    return 0;
}
```

### 表达式

由运算符和操作数组成的有意义式子，如 `a + b * 2`、`x > 0 && y < 10`。


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.1l.lol/basics/identifiers.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
