Flow of Control | C++ - Statements | 11th Computer Science : Chapter 10 : Flow of Control

Chapter: 11th Computer Science : Chapter 10 : Flow of Control

Statements

A computer program is a set of statements or instructions to perform a specific task. These statements are intended to perform specific action.

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

 

(i) Null 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.

 

(ii) Compound (Block) statement

 

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;

}

 

For example

{

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.

 

Tags : Flow of Control | C++ , 11th Computer Science : Chapter 10 : Flow of Control
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
11th Computer Science : Chapter 10 : Flow of Control : Statements | Flow of Control | C++


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.