Statements are the basic commands that express the behaviour of a C program. All other language constructs exist to help organize statements so that each has a specific meaning at its position in the program. Consequently, statements can only be used in certain places, namely function bodies.

There are several kinds of statement:

statement
goto-labelled-statement
switch-labelled-statement
compound-statement
null-statement
expression-statement
selection-statement
iteration-statement
jump-statement
goto-labelled-statement
identifier : statement
switch-labelled-statement
case constant-expression : statement
default : statement
compound-statement
{ block-item-list }
since C99
{ declarationsopt statementsopt }
until C99
null-statement
;
expression-statement
expression ;
selection-statement
if ( expression ) statement
if ( expression ) statement else statement
switch ( expression ) statement
iteration-statement
while ( expression ) statement
do statement while ( expression ) ;
for ( expressionopt ; expressionopt ; expressionopt ) statement
for ( declaration expressionopt ; expressionopt ) statement
since C99
jump-statement
goto identifier ;
continue ;
break ;
return expressionopt ;

A label can be attached to any statement, allowing it to be a target for a goto. Labels formed using case or default are only for use with switch.


CHaR
Sitemap Supported
Site format updated 2024-06-05T22:37:07.391+0000
Data updated 1970-01-01T00:00:00.000+0000
Page updated 2022-06-17T21:43:05.000+0000