算术运算符

运算符

描述

+

两个操作数相加

-

第一操作数减去第二个操作数

*

两个操作数相乘

/

分子除以分母

%

模运算和整数除法后的余数

++

递增操作增加一个整数值

--

递减操作减少一个整数值

 

关系运算符

操作符

描述

==

检查两个操作数的值是否相等,如果值相等,条件为真。

!=

检查两个操作数的值是否相等,如果值不相等,条件变为真。

检查左边的操作数的值是否大于右操作数的值,如果是,条件为真。

检查左边的操作数的值是否小于右操作数的值,如果是,条件为真。

>=

检查左边的操作数的值是否大于或等于右操作数的值,如果是,条件为真。

<=

检查左边的操作数的值是否小于或等于右操作数的值,如果是,条件为真。

 

逻辑运算符

运算符

描述

&&

逻辑与运算符。如果两个操作数都非零,条件为真。

||

逻辑或运算符。如果任何两个操作数是非零,条件为真。

!

逻辑非运算符,反转操作数的逻辑状态。如果条件为真,那么逻辑非操作结果为假。

 

字位运算符

Operator

Description

&

Binary AND Operator copies a bit to the result if it exists in both operands.

|

Binary OR Operator copies a bit if it exists in either operand.

^

Binary XOR Operator copies the bit if it is set in one operand but not both.

~

Binary Ones Complement Operator is unary and has the effect of 'flipping' bits.

<< 

Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand.

>> 

Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand.

 

赋值运算符

运算符

描述

=

赋值操作符,数值从右侧操作数赋给左侧操作数

+=

加法赋值运算符,将左、右操作数相加并将结果赋值给左操作数

-=

减法赋值运算符,将左、右操作数相减并将结果赋值给左操作数

*=

乘法赋值运算符,将左、右操作数相乘并将结果赋值给左操作数。

/=

除法赋值运算符,把左操作数与右操作数相除并将分结果赋值给左操作数。

%=

模量赋值运算符,使用两个操作数进行模量并将结果赋值给左操作数。

<<=

左移位并赋值运算符。

>>=

右移位并赋值运算符。

&=

按位与赋值运算符。

^=

按位异或并赋值运算符。

|=

按位或并赋值运算符。

 

条件运算符

操作符

描述

? :

条件表达式。

 

逗号运算符

操作符

描述

,

用于把若干表达式组合成一个表达式。

 

指针运算符

操作符

描述

&

返回一个变量的地址。

*

指针指向一个变量。

 

特殊运算符

操作符

描述

sizeof()

返回变量的大小。

()

强制类型转换/(表达式)/函数(参数列表)。

[ ]

数组下标。

.

成员运算符。

->

成员运算符。

 

posted on 2016-08-24 19:44  唧唧歪歪master  阅读(465)  评论(0编辑  收藏  举报