Null statement

The null statement performs no operation. It has the form:

Read syntax diagramSkip visual syntax diagram>>-;-----------------------------------------------------------><
 

A null statement can hold the label of a labeled statement or complete the syntax of an iterative statement.

The following example initializes the elements of the array price. Because the initializations occur within the for expressions, a statement is only needed to finish the for syntax; no operations are required.

for (i = 0; i < 3; price[i++] = 0)
   ;

A null statement can be used when a label is needed before the end of a block statement. For example:

void func(void) {
  if (error_detected)
    goto depart;
  /* further processing */
  depart: ;  /* null statement required */
}