C language
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
This is a brief reference of available C constructs.
目录 |
[编辑] 大会的主题
[编辑] 预处理器
[编辑] 评论
[编辑] 关键字
[编辑] ASCII表
[编辑] 转义序列
[编辑] C
[编辑] 流量控制
[编辑] 条件执行语句
Different code paths are executed according to the value of given expression
- if执行代码的条件Original:if executes code conditionallyThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - switch执行代码的整体参数的值Original:switch executes code according to the value of an integral argumentThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 迭代语句
The same code is executed several times
- for executes loop
- while执行循环,在每次迭代之前检查条件Original:while executes loop, checking condition before each iterationThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - 执行循环,在每次迭代后的检查条件Original:DO-WHILE</div> executes loop, checking condition after each iterationOriginal:do-whileThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 跳转语句
Continue execution at a different location
- continue跳过封闭的循环体的其余部分Original:continue skips the remaining part of the enclosing loop bodyThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - break结束的封闭循环Original:break terminates the enclosing loopThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - goto在其他位置继续执行Original:goto continues execution in another locationThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - return终止执行的封闭功能Original:return terminates execution of the enclosing functionThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 功能
The same code can be reused at different locations in the program
- <div class="t-tr-text"> 函数声明</div> declares a functionOriginal:function declarationThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - <div class="t-tr-text"> 的历史。内嵌说明</div> hints the compiler to insert a function's body directly into the calling codeOriginal:inline specifierThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
[编辑] 类型
- <div class="t-tr-text"> 基本类型</div> defines basic character, integer and floating point typesOriginal:fundamental typesThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - <div class="t-tr-text"> 指针类型</div>, holding a memory locationOriginal:pointer typesThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - <div class="t-tr-text"> 复合类型</div> defines types, holding several data members (essentially the same as class)Original:compound typesThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - <div class="t-tr-text"> 枚举类型</div> defines types, that are able to hold only one of the specified valuesOriginal:enumeration typesThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - <div class="t-tr-text"> 联合类型</div> defines types, that can hold data in several representationsOriginal:union typesThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - 定义函数调用签名,那是类型的参数和返回类型Original:函数类型</div> define function call signatures, that is the types of arguments and the return typeOriginal:function typesThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 规范
- <div class="t-tr-text"> CV符</div> specifies constness and volatility of a typeOriginal:cv specifiersThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - <div class="t-tr-text"> 存储类说明</div> specifies storage duration and linkage of a typeOriginal:storage-class specifiersThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - 指定的变量的存储空间应保持一致的具体数额(C99 起)Original:alignas说明</div> specifies that the storage for the variable should be aligned by specific amount (C99 起)Original:alignas specifierThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 常
Literals are the tokens of a C program that represent constant values, embedded in the source code.
- 是十进制,八进制或十六进制数字的整数类型.Original:整数文字</div> are decimal, octal, or hexadecimal numbers of integer type.Original:integer literalsThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - <div class="t-tr-text">字符文字</div> are individual characters of type char, char16_t, char32_t, or wchar_t.Original:character literalsThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - 类型float,double,或long double的值Original:浮点文字</div> are values of type float, double, or long doubleOriginal:floating-point literalsThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - <div class="t-tr-text">字符串文字</div> are sequences of characters, which may be narrow, multibyte, or wide.Original:string literalsThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - <div class="t-tr-text">布尔文字</div> are values of type bool, that is true and false (C99 起)Original:boolean literalsThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - 用户指定的类型(C99 起)是恒定值Original:用户自定义的文字</div> are constant values of user-specified type (C99 起)Original:user-defined literalsThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 表达式
You can help to correct and verify the translation. Click here for instructions.
- <div class="t-tr-text">为了评价</div> of arguments and subexpressions specified the order in which intermediate results are obtained.Original:order of evaluationThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - operators允许使用的语法中常见的数学Original:operators allow the use of syntax commonly found in mathematicsThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
| Common operators | ||||||
|---|---|---|---|---|---|---|
| 分配 | incrementNJdecrement | 算术 | 合乎逻辑的 | 比较 | memberNJaccess | 其他 |
|
a = b |
++a |
+a |
!a |
a == b |
a[b] |
a(...) |
- <div class="t-tr-text"> 运算符的优先级</div> the order in which operators are bound to their argumentsOriginal:operator precedenceThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - <div class="t-tr-text"> 另一种表示形式</div> alternative spellings for some of the operatorsOriginal:alternative representationsThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
[编辑] 实用工具
You can help to correct and verify the translation. Click here for instructions.
- <div class="t-tr-text"> typedef声明</div> creates a synonym for a typeOriginal:typedef declarationThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions. - <div class="t-tr-text"> 属性</div> defines additional information about variable (C99 起)Original:attributesThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click here for instructions.
- 的隐式转换为另一种类型Original:标准的转换</div> implicit conversions from one type to anotherOriginal:standard conversionsThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.