C/C++速查表

整理的一份C/C++的速查表,平时整理下放到这里来,供方便查询。

C++ Operator Precedence

结合律运算符功能用法
::全局作用域::name
::类作用域class::name
::命名空间作用域namespace::name
.成员选择object.member
->成员选择pointer->member
[]下标expr[expr]
()函数调用name(expr_list)
()类型构造type(expr_list)
++后置递增运算lvalue++
--后置递减运算lvalue--
typeid类型IDtypeid(type)
typeid运行时类型IDtypeid(expr)
explicit cast类型转换cast_name(expr)
++前置递增运算++lvalue
--前置递减运算--lvalue
~位求反~expr
!逻辑非!expr
-一元负号-expr
+一元正号+expr
*解引用*expr
&取地址&lvalue
()类型转换(type)expr
sizeof对象的大小sizeof expr
sizeof类型的大小sizeof(expr)
sizeof参数包的大小sizeof…(name)
new创建对象new type
new[]创建数组new type[size]
delete释放对象delete expr
delete[]释放数组delete[] expr
noexcept能否抛出异常noexcept(expr)
->*指向成员选择的指针ptr->*ptr_to_member
.*指向成员选择的指针obj.*ptr_to_member
*乘法expr*expr
/除法expr/expr
%取模(取余)expr%expr
+加法expr+expr
-减法expr-expr
<<向左移位expr<<expr
>>向右移位expr>>expr
<小于expr<expr
<=小于等于expr<=expr
>大于expr>expr
>=大于等于expr==expr
==相等expr>=expr
!=不相等expr!=expr
&位与expr&expr
^位异或expr^expr
¦位或expr ¦ expr
&&逻辑与expr && expr
¦¦逻辑或expr ¦¦ expr
?:条件(三目运算符)expr?exper:expr
=赋值lvalue=expr
*/,/=,%=,+=,-=,<<=,>>=,&=, ¦=,^=复合赋值lvalue+=expr等
throw抛出异常throw expr
,逗号运算符expr,expr

C++ Keywords

alignas (since C++11)elserequires (concepts TS)
alignof (since C++11)enumreturn
andexplicitshort
and_eqexport(1)signed
asmexternsizeof
auto(1)falsestatic
bitandfloatstatic_assert (since C++11)
bitorforstatic_cast
boolfriendstruct
breakgotoswitch
caseiftemplate
catchinlinethis
charintthread_local (since C++11)
char16_t (since C++11)longthrow
char32_t (since C++11)mutabletrue
classnamespacetry
complnewtypedef
concept (concepts TS)noexcept (since C++11)typeid
constnottypename
constexpr (since C++11)not_equnion
const_castnullptr (since C++11)unsigned
continueoperatorusing(1)
decltype (since C++11)orvirtual
default(1)or_eqvoid
delete(1)privatevolatile
doprotectedwchar_t
doublepublicwhile
dynamic_castregisterxor
reinterpret_castxor_eq

Conversion Specifiers in C

ConversionOutput Specification
%aFloating-point number, hexadecimal digits and p-notation (C99/C11).
%AFloating-point number, hexadecimal digits and P-notation (C99/C11). Exploring and Exploiting printf() and scanf()
%cSingle character.
%dSigned decimal integer.
%eFloating-point number, e-notation.
%EFloating-point number, e-notation.
%fFloating-point number, decimal notation.
%gUse %f or %e , depending on the value. The %e style is used if the exponent is less than −4 or greater than or equal to the precision.
%GUse %f or %E , depending on the value. The %E style is used if the exponent is less than −4 or greater than or equal to the precision.
%iSigned decimal integer (same as
%oUnsigned octal integer.
%pA pointer.
%sCharacter string.
%uUnsigned decimal integer.
%xUnsigned hexadecimal integer, using hex digits 0f .
%XUnsigned hexadecimal integer, using hex digits 0F .
%%Prints a percent sign.
全文完,若有不足之处请评论指正。

扫描二维码,分享此文章

本文标题:C/C++速查表
文章作者:ZhaLiPeng
发布时间:2015年01月15日 23时56分
本文字数:本文一共有612字
原始链接:https://imzlp.me/posts/14660/
许可协议: CC BY-NC-SA 4.0
转载请保留原文链接及作者信息,谢谢!
您的捐赠将鼓励我继续创作!