An expression is a sequence of operators and their operands, that specifies a computation.
Expression evaluation may produce a result (e.g., evaluation of
2+2 produces the result
4), may generate side-effects (e.g. evaluation of
printf("%d",4) sends the character
'4' to the standard output stream), and may designate objects or functions.
|assignment|| increment |
|arithmetic||logical||comparison|| member |
| || || || || || ||
CX_LIMITED_RANGEas well as the floating-point evaluation precision and rounding direction control the way floating-point expressions are executed.
The operands of any operator may be other expressions or they may be primary expressions (e.g. in
1+2*3, the operands of operator+ are the subexpression
2*3 and the primary expression
Primary expressions are any of the following:
Any expression in parentheses is also classified as a primary expression: this guarantees that the parentheses have higher precedence than any operator.
Constant values of certain types may be embedded in the source code of a C program using specialized expressions known as literals (for lvalue expressions) and constants (for non-lvalue expressions).
char32_t, (since C11)or
wchar_tthat represent null-terminated strings
The operands of the sizeof operator , the _Alignof operator, and the controlling expression of a generic selection, (since C11) are expressions that are not evaluated (unless they are VLAs) (since C99). Thus,
size_t n = sizeof(printf("%d", 4)); does not perform console output.
| C++ documentation for
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.