Program Flow and Sequential Structure

Flow

  • The order in which statements are executed when a program runs.

Flow control statements are used to control the execution order of statements in a program.
Structured programming design specifies three basic flow structures:

  • Sequential Structure
  • Branch (Selection) Structure
  • Loop Structure

I. Statements

  • Simple Statements
    • End with ;, representing an action to be executed, which can be assignment, judgment, or jump, etc.
  • Compound Statements
    • A block of statements enclosed in {}, generally consisting of multiple statements.

II. Sequential Structure

shunxu

The sequential structure is the simplest of the basic control structures. In the sequential structure, program statements are executed in the order they are written.

  • No need for special flow control statements
  • Write statements in the desired execution order