Вы находитесь на странице: 1из 1

TYPES OF STATEMENTS

Expression Statements-
These statements include symbol assignments, function call & transfer of control
using goto statement. These statements are always terminated with a semicolon.
Ex:-
(i) x=a*b;
(ii) printf(“sum=%d”,a+b);
(iii) goto next;

We can write two expressions in the same line. Semicolon is not statement terminator but
separator.

Control Statements-
These statements are used for changing the flow of control within a program.
Various control statements are:-
if, if…..else, for, while, do…..while , switch.

Control statements may or may not end with a semicolon.

Compound Statements-
It is a collection of one or more expression statements and control statements. The
compound statement is enclosed within {}. A compound statement never ends with a
semicolon.
Ex:-
if(d>0)
{
X1=(-b + sqrt(d)) / (2*a);
X1=(-b - sqrt(d)) / (2*a);
}

Вам также может понравиться