C 加法运算符C Additive Operators

加法运算符执行加法 (+) 和减法 (-) 运算。The additive operators perform addition (+) and subtraction (-).

语法Syntax

additive-expression:additive-expression:
multiplicative-expressionmultiplicative-expression

additive-expression + multiplicative-expressionadditive-expression + multiplicative-expression

additive-expression - multiplicative-expressionadditive-expression - multiplicative-expression

备注

虽然 additive-expression 的语法包括 multiplicative-expression,但这并不表示需要使用乘法表达式。Although the syntax for additive-expression includes multiplicative-expression, this does not imply that expressions using multiplication are required. 对于 multiplicative-expressioncast-expressionunary-expression,请参阅 C 语言语法摘要中的语法。See the syntax in C Language Syntax Summary, for multiplicative-expression, cast-expression, and unary-expression.

操作数可以是整型值或浮点值。The operands can be integral or floating values. 还可以对指针值执行一些加法运算,如针对每个运算符的讨论中所述。Some additive operations can also be performed on pointer values, as outlined under the discussion of each operator.

相加运算符对整型和浮点型操作数执行常用算术转换。The additive operators perform the usual arithmetic conversions on integral and floating operands. 结果的类型是转换后操作数的类型。The type of the result is the type of the operands after conversion. 由于相加运算符执行的转换不提供溢出或下溢条件,因此,如果在转换后,无法用操作数类型表示加法运算的结果,则信息可能会丢失。Since the conversions performed by the additive operators do not provide for overflow or underflow conditions, information may be lost if the result of an additive operation cannot be represented in the type of the operands after conversion.

另请参阅See Also

加法运算符:+ 和 -Additive Operators: + and -