Control Statements

A C program execution starts from the main function. Each statement in the main function block is executed in sequence until the end of the main block or when a return statement is encountered.

However it is possible to control the execution flow of the program using control statements. The control statements are used to conditionally execute or to skip some statement or statement block.

Control statements are of two types - branching and looping. Branching statements can decide which set of statement to execute and looping statements can decide how many times to execute a set of statements.

Branching statements are:

  • if
  • if ... else
  • Nested if
  • switch

Looping statements are:

  • while
  • do ... while
  • for

Post a comment


Your Comment

Email (We dont publish it)


Nothing the first to share wisdom.