Programming flag variables are used in programs for remembering states or conditions. What are the two best data types to use for flags? Give an example of a flag that remembers if a value is negative, zero or positive.

What will be an ideal response?

Program flags are usually Boolean or integer, and sometime chars. The two best are bools and ints. If a program had to remember if a value was positive, negative or zero, you’d need to use an integer value or char. If you used an int you could set the value to –1, 0, or +1. If you used a char you could use the letters ‘p’, ‘z’, or ‘n’.

Computer Science & Information Technology

You might also like to view...

The term network ________ refers to the design of a network

Fill in the blank(s) with correct word

Computer Science & Information Technology

At the top of a window in an Office application, the ________ bar displays the name of the file and the name of the program

A) title B) status C) menu D) ribbon

Computer Science & Information Technology