The statements of a C program control the flow of program execution. C statements consist of tokens, expressions, and other statements. In C, several kinds of statements are available to perform loops, to select other statements to be executed, and to transfer control.
Labeled Statement:
A compound statement is the way C groups multiple statements into a single statement. It consists of multiple statements and declarations within braces (i.e. { and }).
Expression Statement:
An expression statement consists of an optional expression followed by a semicolon (;). If the expression is present, the statement may have a value. If no expression is present, the statement is often called the null statement.
Selection Statement:
Three types of selection statements exist in C:
Iteration Statement:
C has three kinds of iteration statements.
Jump Statement:
C has four types of jump statements.
Labeled Statement:
- A statement can be preceded by a label. Three types of labels exist in C.
- A simple identifier followed by a colon (:) is a label. Usually, this label is the target of a
goto
statement. - Within
switch
statements,case
anddefault
labeled statements exist.
A compound statement is the way C groups multiple statements into a single statement. It consists of multiple statements and declarations within braces (i.e. { and }).
Expression Statement:
An expression statement consists of an optional expression followed by a semicolon (;). If the expression is present, the statement may have a value. If no expression is present, the statement is often called the null statement.
Selection Statement:
Three types of selection statements exist in C:
if ( expression ) statement
if ( expression ) statement else statement
switch ( expression ) statement
Iteration Statement:
C has three kinds of iteration statements.
while ( expression ) statement
do statement while ( expression )
for ( expression ; expression ; expression ) statement
Jump Statement:
C has four types of jump statements.
goto identifier ;
break ;
continue ;
return expression ;
Related topics:
Decision Making Statements in C | The if Statement in C | The if-else Statement in C | The else-if Statement in C | Nested if-else Statement in C | Forms of if Statement in C | Switch Statement in C | Conditional Operator Statement in C | The null Statement in C
List of topics: C Programming
No comments:
Post a Comment