Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

expressions and operators — concept C23

An expression computes a value and may cause side effects; precedence and associativity determine grouping but do not generally determine operand evaluation order. Integer promotions, usual arithmetic conversions, and sequencing matter because unsequenced modifications of one object can be undefined.

Version: C23

Syntax

expressions and operators

An expression computes a value and may cause side effects; precedence and associativity determine grouping but do not generally determine operand evaluation order. Integer promotions, usual arithmetic conversions, and sequencing matter because unsequenced modifications of one object can be undefined.

In calculations, split a complex expression into named steps when several operands have side effects. Parentheses document intended grouping but do not establish evaluation order; separate statements create the needed sequencing.

Check division by zero, INT_MIN / -1, signed overflow, shifts outside the width, and mixed signed/unsigned arithmetic. The comma operator sequences its operands, but a comma separating function arguments gives no such guarantee.

Examples

#include <stdio.h>

int main(void) {
    int value = 2 + 3 * 4;
    printf("%d\n", value);
    return 0;
}

Result

14

An expression computes a value and may cause side effects; precedence and associativity determine grouping but do not generally determine operand evaluation order. Integer promotions, usual arithmetic conversions, and sequencing matter because unsequenced modifications of one object can be undefined.

Sources