View Single Post
  #2 (permalink)  
Old 08-03-2007, 05:52 AM
vijayanand vijayanand is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 293
vijayanand is on a distinguished road
Default Re: What is the difference between a statement and a block?

hi sundarraj,
Statement
Statement has three types
assignment
=

selection (branching)
if (expression)
else
switch

iteration (looping)
while (expression)
for (expression;expression;expression)
do {block}

Blocks
These statements are grouped into blocks, a block is identified by curly brackets...There are two types of block.
statement blocks
if ( i == j)
{
printf("martin \n");
}

The statement block containing the printf is only executed if the i == j expression evaluates to TRUE.

function blocks
int add( int a, int b) /* Function definition */
{
int c;
c = a + b;
return c;
}
The statements in this block will only be executed if the add function is called.
__________________

J.Vijayanand
Reply With Quote