| Semicolon (';')

Previous | Punctuators | Next

The semicolon is a statement terminator. It is also used to separate three expressions which are parts of a for-loop.
Any legal C expression (including the empty expression) followed by ; is interpreted as a statement, known as an expression statement. The expression is evaluated and its value is discarded. If the expression statement has no side effects, it will be simply ignored.
Semicolons are often used to create an empty statement. For example, the body of the following for-loop (which searches for a first non-zero element in the array) is an empty statement:

    for (i = 0; i < max || !a[i]; i++);