C – Compound Statement 2017-08-05T14:46:51+00:00

Compound Statements :

  • A compound statement (also called a “block”) typically appears as the body of another statement, such as the if statement, for statement, while statement, etc
  • It consists of several individual statements enclosed within a pair of braces { }. The individual statements may themselves be expression statements, compound statements or control statements. Unlike expression statements, a compound statements does not end with a semicolon. A typical Compound statements is given below.





             The particular compound statement consists of two assignment-type expression statements.

Accessibility of variables inside and outside of compound statement :

  • A variable which is declared above (outside) the compound statements, it is accessible both inside and outside the compound statements.
  • A variable which is declared inside the compound statements it is not accessible outside the compound statements.
  • It is possible to declare a variable with the same name both inside and outside the compound statements.


Output :

Enter radius of circle


Area of the circle = 28.26

Prev Next