Expressions

An expression can be one of the following:

Expressions can be grouped using parentheses, and may be recursive, meaning that an expression can consist of subexpressions.

Arithmetic Expression

An arithmetic expression is any combination of numeric operands and an arithmetic operator or a bitwise operator.

Examples

a + b
c++
m << 1

Assignment Expression

An assignment expression consists of a variable on the left side of an assignment operator, and an expression on the right side.

Examples

a = x + 42
b += c
s = "Hello"

String Expression

A string expression is any combination of string and char operands and a string operator.

Examples

s + ".brd"
t + 'x'

Comma Expression

A comma expression is a sequence of expressions, delimited by the comma operator.

Comma expressions are evaluated left to right, and the result of a comma expression is the type and value of the rightmost expression.

Example

i++, j++, k++

Conditional Expression

A conditional expression uses the conditional operator to make a decision within an expression.

Example

int a;
// ...code that calculates 'a'
string s = a ? "True" : "False";

Function Call

A function call transfers the program flow to a user defined function or a builtin function. The formal parameters defined in the function definition are replaced with the values of the expressions used as the actual arguments of the function call.

Example

int p = strchr(s, 'b');