Skip to main content
Logo image

Section 9.10 The Idea of a Flag

Despite the fact that the C-programming language does not have a boolean data type, we can simulate boolean (true/false) behavior using an integer-type variable. This is often called a flag.

Investigate 9.8.

What are some scenarios where it would be useful to have a true/false variable? Any past activities come to mind?

Check Your Understanding Check Your Understanding

1.

What is the value of the variable d once the following code has been executed:
int d, num;
num = 17;
d = ((17%3)==0);