型態名稱 | 位元組 | 其他名稱 | 範圍 |
int | 4 |
signed, signed int | –2,147,483,648 to 2,147,483,647 |
unsigned | 4 | unsigned int | 0 to 4,294,967,295 |
short | 2 | short int, signed short int | –32,768 to 32,767 |
unsigned short | 2 | unsigned short int | 0 to 65,535 |
long long | 8 | long long int, signed long long | –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
unsigned long long | 8 | unsigned long long int | 0 to 18,446,744,073,709,551,615 |
long | 4 | long int, signed long int | –2,147,483,648 to 2,147,483,647 |
unsigned long | 4 | unsigned long int | 0 to 4,294,967,295 |
float | 4 | none | 3.4E +/- 38 (7 digits) |
double | 8 | none | 1.7E +/- 308 (15 digits) |
long double | 同double | none | 同 double |
signed char | 1 | none | –128 to 127 |
unsigned char | 1 | none | 0 to 255 |
wchar | 2 | 0 to 65,535 | |
bool | 1 | none | false or true |
enum | varies | none |
運算子 | 運算類別 | 結合性 | ||
1 | [] | 下標 | 記憶體處理 | 左→右 |
() | 括號 | 運算式 | ||
. | 成員 | 成員 | ||
–> | 指標成員 | |||
後置++ | 遞增 | |||
後置– – | 遞減 | |||
2 | 前置++ | 遞增 | 右→左 | |
前置– – | 遞減 | |||
sizeof | 變數大小 | 記憶體處理 | ||
& | 位址 | |||
* | 指標 | |||
+ | 正號 | 算術 | ||
– | 負號 | |||
~ | 一補數 | 位元運算 | ||
! | 非 | 邏輯 | ||
3 | 轉型 | 單運算元 | 右→左 | |
4 | * | 乘 | 算術 | 左→右 |
/ | 除 | |||
% | 餘數 | |||
5 | + | 加 | 左→右 | |
– | 減 | |||
6 | << | 位元左移, 輸出 | 位元運算, 輸出入 | 左→右 |
>> | 位元右移, 輸入 | |||
7 | < | 小於 | 關係 | 左→右 |
> | 大於 | |||
<= | 小於等於 | |||
>= | 大於等於 | |||
8 | 錯誤:520 | 等於 | 左→右 | |
!= | 不等於 | |||
9 | & | 及 | 位元運算 | 左→右 |
10 | ^ | 互斥或 | 左→右 | |
11 | | | 或 | 左→右 | |
12 | && | 及 | 邏輯 | 左→右 |
13 | || | 或 | 左→右 | |
14 | ? : | 條件運算 | (三運算元) | 右→左 |
15 | = | 指定 | 右→左 | |
*= /= %= +=–= <<= >>= &= ^= |= | ||||
16 | , | 循序求值 | 循序求值 | 左→右 |
|
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
|
字 元名稱 | ASCII
代 號 |
ASCII
編 號 |
逸 出字元 |
Newline 換 行 | NL (LF) | 10 | \n |
Horizontal tab 水 平定位點 | HT | 9 | \t |
Vertical tab 垂 直定位點 | VT | 11 | \v |
Backspace 倒 退 | BS | 8 | \b |
Carriage return 回 車 | CR | 13 | \r |
Formfeed 換 頁 | FF | 12 | \f |
Alert 警 示 | BEL | 7 | \a |
Backslash 倒 斜線 | \ | 92 | \\ |
Question mark 問 號 | ? | 63 | \? |
Single quotation mark 單 引號 | ' | 39 | \' |
Double quotation mark 雙 引號 | " | 34 | \" |
Octal number 八 進位 | ooo | — | \ooo |
Hexadecimal number 十 六進位 | hhh | — | \xhhh |
Null character 空 字元 | NUL | 0 | \0 |