Enjoying the preview?
This is the free first lesson. Get full access — request a demo or sign in.
Enjoying the preview?
This is the free first lesson. Get full access — request a demo or sign in.
Making decisions in code is one of the main features of a programming language, and the primary way to make decisions in C is by using one or the other form of the if statement. Simple decisions can be made with an if-else statement while more complex decisions require an if-else if statement.
When making simple if-else decisions, C provides a concise operator for your use: the conditional operator. In these lessons, we’ll start out reviewing the various if statement forms. Then we’ll discuss how the conditional operator is used to make either-or decisions. Finally, we’ll go over an example of a problem that lends itself to a conditional operator solution.
The course reviews the various if statement forms, explains how the conditional operator is used to make either-or decisions, and works through an example of a problem that lends itself to a conditional operator solution.
You will be able to describe the if statement forms, explain how the conditional operator is formed, and understand when to use the conditional operator instead of if-else statements.
The course includes three lessons: If-Else and If-Else If Statements, The Conditional Operator, and Advanced Conditional Operator Uses.
It focuses on conditional statements, conditional expressions, conditional compilation, logical operators, operators in C and C++, and interactive C.
The conditional operator is a concise way to make either-or decisions; the course covers when to use it instead of if-else statements, including a problem that lends itself to a conditional operator solution.