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,
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值