Arithmetic Expressions

Arithmetic expressions in C consist of numbers, variables, and operators that evaluate to a numeric value. These expressions use arithmetic operators to perform mathematical operations.

Example:


#include <stdio.h>
int main() {
    int a = 10, b = 5;
    int sum = a + b;
    printf("Sum: %d\n", sum);
    return 0;
}

Output

Sum: 15

Precedence and Associativity

Precedence and associativity are rules that determine the order in which operators are evaluated in an expression. Arithmetic operators follow precedence rules: