Statements
A
computer program is a set of statements or instructions to perform a specific
task. These statements are intended to perform specific action. The action may
be of variable declarations, expression evaluations, assignment operations,
decision making, looping and so on.
There
are two kinds of statements used in C++.
(i)
Null statement
(ii)
Compound statement
The
"null or empty statement" is a statement containing only a semicolon.
It takes the flowing form:
; // it is a null statement
Null
statements are commonly used as placeholders in iteration statements or as
statements on which to place labels at the end of compound statements or
functions.
C++
allows a group of statements enclosed by pair of braces {}. This group of
statements is called as a compound statement or a block.
The
general format of compound statement is:
{
statement1;
statement2;
statement3;
}
{
int x, y;
x = 10;
y = x + 10;
}
The
compound statement or block is a treated as a single unit and may be appear
anywhere in the program.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.