亚洲区国产区激情区无码区,国产成人mv视频在线观看,国产A毛片AAAAAA,亚洲精品国产首次亮相在线

C++ 基礎(chǔ)教程

C++ 流程控制

C++ 函數(shù)

C++ 數(shù)組 & 字符串

C++ 數(shù)據(jù)結(jié)構(gòu)

C++ 類(lèi) & 對(duì)象

C++ 指針

C++ 繼承

C++ STL 教程

C++ 參考手冊(cè)

c++ 關(guān)鍵字和標(biāo)識(shí)符

在本教程中,我們將學(xué)習(xí)關(guān)鍵字(C ++編程中的保留關(guān)鍵字,它們是語(yǔ)法的一部分)。另外,我們還將學(xué)習(xí)標(biāo)識(shí)符以及如何命名它們。

C++ 關(guān)鍵字

關(guān)鍵字是預(yù)定義的單詞,對(duì)編譯器具有特殊的含義。例如,

int money;

這里,int是一個(gè)關(guān)鍵字,表示money是整數(shù)類(lèi)型的變量。

這是所有C ++關(guān)鍵字的列表。(從C ++ 17開(kāi)始)

alignasdecltypenamespacestruct
alignofdefaultnewswitch
anddeletenoexcepttemplate
and_eqdonotthis
asmdoublenot_eqthread_local
autodynamic_castnullptrthrow
bitandelseoperatortrue
bitorenumortry
boolexplicitor_eqtypedef
breakexportprivatetypeid
caseexternprotectedtypename
catchfalsepublicunion
charfloatregisterunsigned
char16_tforreinterpret_castusing
char32_tfriendreturnvirtual
classgotoshortvoid
complifsignedvolatile
constinlinesizeofwchar_t
constexprintstaticwhile
const_castlongstatic_assertxor
continuemutablestatic_castxor_eq

注意:由于C ++是區(qū)分大小寫(xiě)的語(yǔ)言,因此所有關(guān)鍵字都必須用小寫(xiě)字母編寫(xiě)。

C++ 標(biāo)識(shí)符

標(biāo)識(shí)符是程序員給變量、類(lèi)、函數(shù)或其他實(shí)體的唯一名稱(chēng)。例如,

int money;
double accountBalance;

在這里,money和accountBalance是標(biāo)識(shí)符。

標(biāo)識(shí)符命名規(guī)則

  • 標(biāo)識(shí)符可以由字母,數(shù)字和下劃線(xiàn)字符組成。

  • 它對(duì)名稱(chēng)長(zhǎng)度沒(méi)有限制。

  • 它必須以字母或下劃線(xiàn)開(kāi)頭。

  • 區(qū)分大小寫(xiě)。

  • 我們不能將關(guān)鍵字用作標(biāo)識(shí)符。

如果遵循上述規(guī)則,我們可以選擇任何名稱(chēng)作為標(biāo)識(shí)符。但是,我們應(yīng)該為有意義的標(biāo)識(shí)符提供有意義的名稱(chēng)。

好壞標(biāo)識(shí)符示例

不合法的識(shí)別符錯(cuò)誤的標(biāo)識(shí)符好的標(biāo)識(shí)符
Total pointsT_pointstotalPoint
1listlist_1list1
floatn_floatfloatNumber