C – Statements and Types of Statements

digitalample eye

Any line written in a ‘c’ editor that normally terminates by a semicolon ‘;’ is  called statement.

int a,b,c,d=55;
float rate;
char n; 

Null Statement

If you place a semicolon by itself on a line, you create a null statement-a statement that doesn’t perform any action, that is known as null statement. This is perfectly legal in C. 
: - null statement

Expression Statement

An expression statement is a constant, variable or combination of constant variable. This can also include a function call. An expression statement consist of any valid  C expression and followed by a semicolon. 
a=b; expression statement
c=a+b; expression statement
greater(a,b,c); functional statement

Compound Statement

A compound statement, also called a block, is a group of two or more C statements within a pair of braces ( { and} ). Unlike an expression statement, a compound statement does not end with a semicolon. 

In C, a block can be used anywhere a single statement can be used.

Control Statement 

Control statements are used to create special program features, such as logical tests, loops and branches,
                  printf("A is greater");
                  printf("B is greater");


Please enter your comment!
Please enter your name here