Chapter 3: Problem 21
What is a flag variable?
Short Answer
Expert verified
Answer: A flag variable is a boolean variable that serves as a signal to control the flow of a program based on whether certain conditions have been met or a specific process has been completed. For instance, when checking if a list contains a particular number, a flag variable is initialized as 'false' and set to 'true' when the target number is found. This helps to control the flow of the program depending on the outcome of the search.