Thursday, May 31, 2007

about c Statements

Statements
C has three types of statement.
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;
}

No comments: