There are multiple parts to a statement in C:
operators, operands
expressions
statements
operators -- symbols that have meaning to the compiler: + means add, - means subtract, etc.
operands -- the arguments used by the operators. Most operators require two operands and are
called binary operators:
x + y
x is an operand, y is an operand, and + is the binary operator. There are unary operators (e.g., !)
and ternary operators (= ? : )
expression -- a group of operators and operands that combine to form an expression.
z = x + y
is called an assignment expression. Because of operator precedence, the addition of x and y
is processed as a subexpression yielding an intermediate result, then the assignment operator
causes that intermediate result to be assigned into z.
statement -- a group of one or more expressions that combine to form a complete syntactical unit
or sequence point. These groupings are terminated with a semicolon:
z = x + y;
is called an assignment statement and represents all of the expressions the programmer
wants to form a complete statement.
A for loop is simply three expressions:
for (expression1; expression2; expression3)
expression1 sets the environment for the loop, and may have a comma-separated list of sub-
expressions.
expression2 is some form of expression that evaluates to true or false.
expression3 is one or more expressions that usually relate to the content of the statement body.
An example of a for loop with multiple subexpressions might be:
for (pos = 0, x = 10, y = 5, z = 0; pos <= 180; pos++, z += 2) {
Note the comma-separated list of subexpressions in expression1 and expression3. The semicolons simply act as sequence points for the compiler and tell it that it has enough information about the expression (and subexpressions) to process the expression.