77.4k views
0 votes
What built-in type does C++ use for Boolean values?

A) bool
B) int
C) char
D) double

User Elishia
by
7.2k points

1 Answer

1 vote

Final answer:

The built-in type for Boolean values in C++ is the keyword 'bool', which allows a variable to hold the values true or false. Unlike other types like int, char, and double, bool is specifically used for true/false values.

Step-by-step explanation:

The built-in type that C++ uses for Boolean values is bool. When declaring a Boolean variable in C++, the keyword bool is used to specify the type. This allows the variable to store the value true or false, which are the only two values a Boolean variable can hold. It is different from int, char, and double, which are used for integer, character, and double precision floating point numbers, respectively. For example:

bool isDone = true;

This line of code declares a Boolean variable named isDone and initializes it with the value true.

User Hemmer
by
7.8k points