Home   |   About   |   Terms   |   Contact    
Read & Learn
 

What is Block Statement in C++ ?

C++

☯ All C++ Articles     ☯ All Articles


A new product.




Popular Google Pages:



This article is regarding Block Statement in C++.
Last updated on: .


◕ Let a simple program:
#include <iostream>
using namespace std;
int main(){
cout << "We are Boss!" << endl;
return 0;
}

Here the line,
cout << "We are Boss!" << endl;
is a statement.



What is Statement Block in C++?

We can enclose several statements between a pair of braces. Then they become a block, and behave like a block. This block is called Block Statement or Compound Statement.

Example:
In the above program, the statements inside the main function are

{
cout << "We are Boss!" << endl;
return 0;
}

These statements as whole is called a
Block Statement.

Such a compound statement or block statement can be thought as a single statement. These blocks can be placed inside other blocks. This means blocks can be nested, one within another up to any depth.




Popular Google Pages:



Top of the page

Amazon & Flipkart Special Products

   


Top of the page