Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In C language, which operator is required to be an integer?
In C language, which operator is required to be an integer?
Choose D.

% is a remainder operator, also known as modular division operator, used to find the remainder. % requires both operands to be integers (or types that can be implicitly converted to integers).

The standard stipulates that:

1. If the operand to the left of% is negative, the result of modulo division is negative or 0.

2. If the operand to the left of% is positive, the structure of modulo division is positive or 0.

Extended data:

There are two kinds of associative laws for operators in C language, namely, left associative law (from left to right) and right associative law (from right to left). For example, the combination of arithmetic operators is from left to right, that is, first left and then right. If there is an expression x-y+z, then Y should be combined with "-"for x-y operation, and then +z operation. This combination direction from left to right is called "left combination".

The combination direction from right to left is called "right combination". The most typical right association operator is the assignment operator. If x=y=z, because of the right combination of "=", the operation of y=z should be performed first, and then x=(y=z). Many operators in C language are right-combined, so we should pay attention to the differences.

Baidu encyclopedia -C language operator