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...

Discuss why detailed definition of the organizational boundaries of protected space is an essential step in the proper management of the system which will eventually be implemented.

What will be an ideal response?

Computer Science & Information Technology

A data structure in which only the top element can be accessed is called a(n) _______ .

a. stack b. linear array c. sorted array d. random array e. none of the above

Computer Science & Information Technology

In Project 2013, the default for a duration of one day is ________ hours

A) 6 B) 7 C) 8 D) 10

Computer Science & Information Technology

In order for an Active Directory Domain to function properly, what service is necessary on the network?

What will be an ideal response?

Computer Science & Information Technology