# C 乘法运算符C Multiplicative Operators

multiplicative-expressionmultiplicative-expression:
cast-expressioncast-expression

multiplicative-expression \* cast-expressionmultiplicative-expression \* cast-expression

multiplicative-expression / cast-expressionmultiplicative-expression / cast-expression

multiplicative-expression % cast-expressionmultiplicative-expression % cast-expression

C 乘法运算符的描述如下：The C multiplicative operators are described below:

\* 乘法运算符使其两个操作数相乘。The multiplication operator causes its two operands to be multiplied.
/ 除法运算符使第一个操作数除以第二个操作数。The division operator causes the first operand to be divided by the second. 如果两个整数操作数相除，结果不是整数，则根据下列规则截断它：If two integer operands are divided and the result is not an integer, it is truncated according to the following rules:
- 根据 ANSI C 标准，被 0 除的结果是不确定的。- The result of division by 0 is undefined according to the ANSI C standard. Microsoft C 编译器将在编译时或运行时生成错误。The Microsoft C compiler generates an error at compile time or run time.
- 如果两个操作数都为正或无符号，则结果将截断到 0。- If both operands are positive or unsigned, the result is truncated toward 0.
- 如果其中一个操作数为负，则不管操作结果是小于或等于代数商的最大整数还是大于或等于代数商的最小整数，结果均为定义的实现。- If either operand is negative, whether the result of the operation is the largest integer less than or equal to the algebraic quotient or is the smallest integer greater than or equal to the algebraic quotient is implementation defined. （请参阅下面的 Microsoft 专用部分。）(See the Microsoft Specific section below.)
`%` 第一个操作数除以第二个操作数时，余数运算符的结果是余数。The result of the remainder operator is the remainder when the first operand is divided by the second. 如果除法不精确，则结果将由下列规则确定：When the division is inexact, the result is determined by the following rules:
- 如果右操作数为零，则结果是不确定的。- If the right operand is zero, the result is undefined.
- 如果两个操作数均为正或无符号，则结果为正。- If both operands are positive or unsigned, the result is positive.
- 如果其中一个操作数为负，并且结果不精确，则结果将是定义的实现。- If either operand is negative and the result is inexact, the result is implementation defined. （请参阅下面的 Microsoft 专用部分。）(See the Microsoft Specific section below.)

Microsoft 专用Microsoft Specific

## 示例Examples

``````int i = 10, j = 3, n;
double x = 2.0, y;
``````

``````y = x * i;
``````

``````n = i / j;
``````

``````n = i % j;
``````

Microsoft 专用Microsoft Specific

``````50 % -6 = 2
-50 % 6 = -2
``````