Cloudbook: C

  1. Home
  2. Control
  3. Blocks
  4. § 1 exercise →
Blocks

A block introduces a new scope, and variables declared at the top of the block are in scope until the end of the block. if a variable exists with the same name outside the block, that variable is hidden, and cannot be referred to inside the block.

With the exception of goto's, the block structure means that code flow enters at the top of the block and exits at the bottom of the block. This discipline makes reasoning about programs easier. A block can be terminated from the middle of some blocks with a break or continue statement. Even so, those statement force an early arrival at the bottom of the block.