關鍵字:
1. 保留字
C++中,保留字也稱關鍵字,它是預先定義好的標識符。見關鍵字的解釋。
2.關鍵字
C++中已經被系統定義為特殊含義的一類標識符。C++中的關鍵字有:
auto |
double |
int |
struct |
break |
else |
long |
switch |
case |
enum |
register |
typedef |
char |
extern |
return |
union |
const |
float |
short |
unsigned |
continue |
for |
signed |
void |
default |
goto |
sizeof |
volatile |
do |
if |
static |
while |
asm |
_cs |
_ds |
_es |
_ss |
cdecl |
far |
huge |
interrupt |
near |
pascal |
class |
public |
private |
catch |
protected |
delete |
new |
template |
friend |
this |
inline |
throw |
try |
operator |
virtual |
overload(現不用) |
3.標識符
對變量、函數、標號和其它各種用戶自定義對象的命名。在C++中,標識符長度沒有限制,第一個字符必須是字母或下劃線,其后若有字符則必須為字母、數字或下劃線。例如count2,_x是正確的標識符形式,而hello!,3th則是錯誤的。在C++中標識符區分大小寫,另外標識符不能和C++中的關鍵字相同,也不能和函數同名。