C Programming language

Control Statements in C Programming Language
Previous Home Next

C language provides 2 types of control statements

  1. Branching Statements
  2. Looping Statements
Branching Statements

In branching statement what action is to be performed is decided.

 

If Statements :

if (expression)
statement;

/****************************/

if (expression)
{
	//block of statements;
}

/****************************/

if (expression)
{
	//block of statements;
}
else if(expression)
{
	//block of statements;
}
else
{
	//block of statements;
}

Switch case statements:

switch( expression )
{
	[case constant-expression1: statements1;]
	[case constant-expression2: statements2;] 
	[case constant-expression3: statements3;]
	[default: statements4;]
}
Previous Home Next