What is an expression?

An expression contains both operators and operands.

Example: a = b + c;

We can say, both "b + c" and "a = b + c" are expressions. Every expression will produce a result that can be assigned to a new operand.

In the above expression, we are performing the addition of b & c which will later be assigned to 'a'.

  • '+ =' are operators.
  • a, b, c are the operands.
  • a = (b + c) is an expression.

Statement

There is a lot to explain about the statements. In simple terms, there is no C language without the statements. Statements are the set of instructions that are executed in the sequence and each of them has a predefined action and does not hold any values.

Labelled statement

If the statement is in the following format then it is known as a labelled statement.

Following is the syntax of labelled statements in the c language.

  1. Identifier: statement  - It is mostly used as a target of goto.
  2. case constant-expression: statement
  3. default: statement

Please refer to the articles of goto & switch statements to get a clear idea of the labelled statements.

Expression statement

These are the most used statements in the C language. Expressions that end with a semicolon are known as the expression statements. Most of the expression statements are the assignment or function calls.

The result of one expression will be finalized before processing the expression of another statement.

Compound statement

A compound statement is also known as a block and it starts with '{' and ends with '}'. One or more statements are combined together and formed as a single compound statement.

Syntax:

compound-statement:
{ declaration-list statement-list }

declaration-list:
declaration
declaration-list declaration

statement-list:
statement
statement-list statement

Selection statement

if, else, else if, switch statements are known as a selection statement.

Syntax

selection-statement:
if (expression) statement
if (expression) statement else statement
switch (expression) statement

Iteration statement

For, while, do while statements are known as the iteration statements

Syntax:

iteration-statement:
while (expression) statement
do statement while (expression);
for (expression; expression; expression) statement

Jump statement

Jump statements are used to transfer the control unconditionally.

goto, continue, break, and return statements are considered jump statements.

Syntax

jump-statement:
goto identifier;
continue;
break;
return expression;