C/C++关键字整理
本文共整理了C/C++关键字,其中C关键字32个,C++关键字97个。为了方便使用分别使用三种格式梳理。
C 关键字
共收录32个关键字。
关键字说明auto声明自动变量short声明短整型变量或函数int声明整型变量或函数long声明长整型变量或函数float声明浮点型变量或函数double声明双精度变量或函数char声明字符型变量或函数struct声明结构体变量或函数union声明共用数据类型enum声明枚举类型typedef用以给数据类型取别名const声明只读变量unsigned声明无符号类型变量或函数signed声明有符号类型变量或函数extern声明变量是在其他文件正声明register声明寄存器变量static声明静态变量volatile说明变量在程序执行中可被隐含地改变void声明函数无返回值或无参数,声明无类型指针if条件语句else条件语句否定分支(与 if 连用)switch用于开关语句case开关语句分支for一种循环语句do循环语句的循环体while循环语句的循环条件goto无条件跳转语句continue结束当前循环,开始下一轮循环break跳出当前循环default开关语句中的“其他”分支sizeof计算数据类型长度return子程序返回语句(可以带参数,也可不带参数)循环条件
- 格式一
"void","char","int","float","double","short","long","signed","unsigned","struct","union","enum","typedef","sizeof","auto","static","register","extern","const","volatile","return","continue","break","goto","if","else","switch","case","default","for","do","while"
- 格式二
"void","char","int","float","double","short","long","signed","unsigned","struct","union","enum","typedef","sizeof","auto","static","register","extern","const","volatile","return","continue","break","goto","if","else","switch","case","default","for","do","while",
- 格式三
void,char,int,float,double,short,long,signed,unsigned,struct,union,enum,typedef,sizeof,auto,static,register,extern,const,volatile,return,continue,break,goto,if,else,switch,case,default,for,do,while,
C++ 关键字
共收录97个C++关键字,
来源: https://www.apiref.com/cpp-zh/cpp/keywords.html
- 格式一
"alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","bool","break","case","catch","char","char8_t","char16_t","char32_t","class","compl","concept","const","consteval","constexpr","constinit","const_cast","continue","co_await","co_return","co_yield","decltype","default","delete","do","double","dynamic_cast","else","enum","explicit","export","extern","false","float","for","friend","goto","if","inline","int","long","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","private","protected","public","reflexpr","register","reinterpret_cast","requires","return","short","signed","sizeof","static","static_assert","static_cast","struct","switch","synchronized","template","this","thread_local","throw","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","while","xor","xor_eq",
- 格式二
"alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","bool","break","case","catch","char","char8_t","char16_t","char32_t","class","compl","concept","const","consteval","constexpr","constinit","const_cast","continue","co_await","co_return","co_yield","decltype","default","delete","do","double","dynamic_cast","else","enum","explicit","export","extern","false","float","for","friend","goto","if","inline","int","long","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","private","protected","public","reflexpr","register","reinterpret_cast","requires","return","short","signed","sizeof","static","static_assert","static_cast","struct","switch","synchronized","template","this","thread_local","throw","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","while","xor","xor_eq",
- 格式三
alignas,alignof,and,and_eq,asm,atomic_cancel,atomic_commit,atomic_noexcept,auto,bitand,bitor,bool,break,case,catch,char,char8_t,char16_t,char32_t,class,compl,concept,const,consteval,constexpr,constinit,const_cast,continue,co_await,co_return,co_yield,decltype,default,delete,do,double,dynamic_cast,else,enum,explicit,export,extern,false,float,for,friend,goto,if,inline,int,long,mutable,namespace,new,noexcept,not,not_eq,nullptr,operator,or,or_eq,private,protected,public,reflexpr,register,reinterpret_cast,requires,return,short,signed,sizeof,static,static_assert,static_cast,struct,switch,synchronized,template,this,thread_local,throw,true,try,typedef,typeid,typename,union,unsigned,using,virtual,void,volatile,wchar_t,while,xor,xor_eq,
C++ 有 C 没有的关键字
- 格式一
"alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","bitand","bitor","bool","catch","char8_t","char16_t","char32_t","class","compl","concept","consteval","constexpr","constinit","const_cast","co_await","co_return","co_yield","decltype","delete","dynamic_cast","explicit","export","false","friend","inline","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","private","protected","public","reflexpr","reinterpret_cast","requires","static_assert","static_cast","synchronized","template","this","thread_local","throw","true","try","typeid","typename","using","virtual","wchar_t","xor",
- 格式二
"alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","bitand","bitor","bool","catch","char8_t","char16_t","char32_t","class","compl","concept","consteval","constexpr","constinit","const_cast","co_await","co_return","co_yield","decltype","delete","dynamic_cast","explicit","export","false","friend","inline","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","private","protected","public","reflexpr","reinterpret_cast","requires","static_assert","static_cast","synchronized","template","this","thread_local","throw","true","try","typeid","typename","using","virtual","wchar_t","xor",
- 格式三
alignas,alignof,and,and_eq,asm,atomic_cancel,atomic_commit,atomic_noexcept,bitand,bitor,bool,catch,char8_t,char16_t,char32_t,class,compl,concept,consteval,constexpr,constinit,const_cast,co_await,co_return,co_yield,decltype,delete,dynamic_cast,explicit,export,false,friend,inline,mutable,namespace,new,noexcept,not,not_eq,nullptr,operator,or,or_eq,private,protected,public,reflexpr,reinterpret_cast,requires,static_assert,static_cast,synchronized,template,this,thread_local,throw,true,try,typeid,typename,using,virtual,wchar_t,xor,