Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - 2.8 If the variable has been correctly defined and assigned, the expression conforming to the syntax of C language is
2.8 If the variable has been correctly defined and assigned, the expression conforming to the syntax of C language is
The correct answer is b;

The first is the obvious error options c and d:

C The remainder operation (%) is only valid for integers, and there is no remainder operation for floating-point data (12.3).

The left side of d assignment (=) can only be variable (a), not expression (a+7).

Let's see why option b also conforms to c language:

Item b is a comma operator (expression 1, expression 2, ... expression n), in which the last expression (expression n) is the result of the whole comma operation (that is, the final result of item b is a++); Before that, the comma operator will compile all the previous expressions (that is, execute a=7+b+c first) and then return the expression n as the result.

Let's see why A doesn't meet the requirements:

There is no doubt that the compilation of A completely meets the requirements of C language, and the compilation will never go wrong. But the title requirement is "expression";

In C language, a statement consists of an expression and a statement terminator (semicolon; ). There is a semicolon at the end of option A, that is to say, option A is actually a C language statement, not an expression; Option b has no statement terminator, so option b is an expression, which meets the requirements of the topic.