C – Compound Statement

Home/C - Tutorial/C - Statements/C – Compound Statement
C – Compound Statement 2017-07-19T17:10:40+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
  • A Compound statement 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 statement does not end with a semicolon. A typical Compound statement is given below.

                              {

                                pi=3.14;

                                area=pi*radius*radius;

                                }

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

C – COMPOUND STATEMENT EXAMPLE PROGRAM :

Output :

Enter radius of circle

3

Area of the circle = 28.26

Prev Next