In C programming, a statement is a single instruction that tells the computer to perform a specific action. A program is a sequence of statements that are executed in a specific order.

Here are some examples of common statements in C:


  1. Assignment statement: assigns a value to a variable. For example: x = 5;

  2. Conditional statement: performs an action based on a Boolean condition. For example:

if (x > 0) {

printf("x is positive");

}

  1. Loop statement: repeatedly performs an action while a given condition is true. For example:

for (int i = 0; i < 10; i++) {

printf("%d\n", i);

}

  1. Function call statement: calls a function and passes any necessary parameters. For example:

int result = add(x, y);

  1. Return statement: returns a value from a function. For example:

return x * y;

  1. Expression statement: an expression that does not return a value, but rather has a side effect, for example x++

Statements in C are terminated by a semicolon (;), and a block of code is enclosed in curly braces {}.

Statements can also be grouped together to form a compound statement, also known as a block, which allows you to group multiple statements together and treat them as a single statement. This is useful when you want to group statements that are executed as part of a conditional or loop statement, for example:

if (x > 0) {

x = x + 1;

y = y * 2;

}

It's worth noting that the order of statements in a program is important, as the computer will execute them in the order that they are written, and the control flow statements like if-else, for, while, etc, can change the order of execution of statements.