C EXPRESSIONS AND STATEMENTS – A BRIEF DESCRIPTION

C EXPRESSIONS AND STATEMENTS

C STATEMENTS

Generally, Statement is an executable part of the program and also, causes the computer to carry out some action. Furthermore, instructions are written in the form of Statements in a C program.

Certainly, a C Statement specifies an action. In the most general sense, a Statement is a part of the C program which any user can execute.

C Language categorise statements in the following groups :

  • Expression statements
  • Compound statements
  • Selection statements
  • Iterative statements
  • Jump statements
  • Label statements

1. EXPRESSION STATEMENT :

Expression statements are the statements which consists of an expression which follows a semicolon ( ; ).

The examples of some valid expression​statements are as follows :

  • a = 10;
  • x = y + z;
  • b = b * 10
  • fun(a, b);

NOTE : The statement that has only a semicolon is NULL STATEMENT. Such as , 

;        /* NULL STATEMENT */

 

2. COMPOUND STATEMENT :

Compound statements are the statements that consists of several statements which encloses within a pair of Curly braces { }. These are also known as BLOCK OF STATEMENTS. Another important thing is that there is no semicolon after the closing brace.

The example of a valid Compound statement is as follows :

int a=5, b=2, c=3;

int area, volume;

area = 2 * (a * b + b * c + c * a) ;

volume = a * b * c ;

If we declare any variable inside the block then we should declare it only at the beginning of a block. The variables which we declare inside a block, can be used only inside that block.

 

 

Thus, it was all about C STATEMENTS.. and about the other statements, we will be discussing them on further coming posts..

Therefore, here comes an end to C EXPRESSIONS AND STATEMENTS – A BRIEF DESCRIPTION.. For further information regarding the previous C ELEMENTS Posts click on,

C DATATYPES AND CONSTANTS – A BRIEF DESCRIPTION

C IDENTIFIERS AND VARIABLES – A BRIEF DESCRIPTION

C KEYWORDS – A BRIEF DESCRIPTION

THE C ELEMENTS

Leave a comment

Your email address will not be published. Required fields are marked *

10 thoughts on “C EXPRESSIONS AND STATEMENTS – A BRIEF DESCRIPTION”