# C Statements and blocks.

## 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;
      	}

  The statements in this block will only be executed if the add function is called. Complete function example

Top | Master Index | Keywords | Functions