Statements

A statement is an executable part of the program. In C Program, instructions are written in the form of statements.

Some category of Statements

  1. Expression statements
  2. Compound statements
  3. Selection statements
  4. Iterative statements
  5. Jump statements
  6. Label statements


Expression statement

Expression statement is consists of expression followed by semicolon ( ; ).

Example :-

x=4;
a=b-c;
func(a,b);
A statement that has only a semicolon is called null statement.

Compound statement

Compound statement is called block of statements.Compound statement is consists of several statements enclosed within a pair of curly braces { }.

Example :-

{
int l=2,b=5,h=3;
int area,volume;
area=5(l*b+b*h+h*l);
volume=l*b*h;
}
Variable is to be declared inside the block,it can be declared at the beginning of the block.

Selection statements

Selection statements are a bi-directional statements which are used to take one of the two possible actions. such as:
  • if-else statement
  • switch statement

Iterative statements

Iterative statements are used for execute a part of the program repeatedly till some expression is true. Iterative statements are:
  • for statement
  • while statement
  • do…while statement

Jump statements

Jump statements are an unconditional statements. They are used to interrupt switch and looping statements. Jump statements are:
  • break statement
  • continue statement
  • goto statement
  • return statement

Label statements

There are a three label statements default, case and label statement used in a goto statement, a label is C identifier and it is followed by colon. A default and case are keyword used in the switch statement.