O'Reilly logo

Learn to Program with C by Noel Kalicharan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 4

image

Programs with Selection Logic

In this chapter, we will explain the following:

  • What are Boolean expressions
  • How C represents Boolean values
  • How to write programs using if
  • How to write programs using if...else
  • Where semicolons are required, where they are optional, and where they must not be put
  • How a program should be tested
  • Why symbolic constants are useful and how to use them in a C program

4.1 Introduction

In the last chapter, we showed how to write programs using sequence logic—programs whose statements are executed “in sequence” from the first to the last.

In this chapter, the programs will use selection logic—they will test some ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required