answersLogoWhite

0


Best Answer

It depends on the implementation. Technically, only one, because that's all you need to store a true/false value. From an implementation standpoint, however, the compiler may well allocate a full byte, or even a word, for a boolean variable, because the cost of doing bit manipulation is too much, both in terms of time and of space.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How many bits in a bool variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How many values can store a variable at a time?

Yes. For example: char c= 'A'; ... c= 'B';


What is boolean in C Sharp?

A boolean is a variable type that can only be two different values True or False same as it is in most programming languages but in C# booleans are stated as: public bool var = True; or public bool var = False;


Program to do for cplusplus that needs the else if ladder can you tell you how to do that?

if (bool expression 1){...}else if (bool expression 2){...}else if (bool expression 3){...}


How is Boolean used in python?

Python has two constant objects, True and False and a bool() function. The bool() function simply casts its argument to one of the two Boolean objects. All integral types (integers) will implicitly cast to True or False, such that the value zero is always False and non-zero is always True. Floating point types can also be implicitly cast (such that 0.0 is always False) however floating point values are approximations and should never be used implicitly. Instead, use comparison operators to perform an explicit cast: if x == 0.0: # do something All the comparison operators return True or False, as do all the logic operators (and, or and not). However, it is never necessary to compare an expression with the True object: if x == True: The above can be reduced to the more efficient: if x: Where x cannot be implicitly cast to a Boolean constant, use the bool() function to perform an explicit cast: if bool(x): If you need to reverse the logic, you might use the following: if bool (x) == False: However, it is arguably more readable to use the not logic operator instead: if not (bool (x)): You can experiment with Boolean types through the bool function: bool ('') # False bool ('a string') # True bool ([]) # False bool ([1,2,3]) # True bool (0) # False bool (1) # True bool (0.0) # False bool (42.0) # True bool (False) # False bool (True) # True Note that the last two are redundant casts.


What kind of information is represented by a pointer variable?

It is variable. On most PCs it is either 32 or 64 bits. But it can be smaller on other systems. To find the size use sizeof(void*) .

Related questions

How many values can store a variable at a time?

Yes. For example: char c= 'A'; ... c= 'B';


What is boolean in C Sharp?

A boolean is a variable type that can only be two different values True or False same as it is in most programming languages but in C# booleans are stated as: public bool var = True; or public bool var = False;


When did Henry Bool die?

Henry Bool died in 1922.


What is the prefix for variable?

In programming, the term "prefix" typically refers to a naming convention that precedes the name of a variable. Common prefixes include "int" for integer variables, "str" for string variables, "bool" for boolean variables, and so on. These prefixes help developers quickly identify the data type of a variable.


When was Choi Bool-am born?

Choi Bool-am was born on 1940-06-15.


When was Al Bool born?

Al Bool was born on 1897-08-24.


When did Al Bool die?

Al Bool died on 1981-09-27.


Program to do for cplusplus that needs the else if ladder can you tell you how to do that?

if (bool expression 1){...}else if (bool expression 2){...}else if (bool expression 3){...}


How many bytes in an address of an int variable?

32 bits or 4 bytes and an int is not an address, it is a primitive so it directly access the data without a reference.


What is the C plus plus code using Boolean value as output?

The question is not clear. If you mean can you write a C++ program such that the main function returns a boolean, the answer is no, you cannot. The main function must return an int to the operating system. However, the return value can be treated as boolean such that non-zero indicates true (an error has occurred) and zero indicates false (no error). Unlike C, C++ does include a primitive bool data type which can only be true or false. All the comparision operators such as ==, !=, <, <=, > and >= return bool and all the integral data types (int, char, wchar_t) can be implicitly converted to and from bool. Converting a bool to an int returns the value -1, since false is typically imlemented with all bits set while true is implemmented with all bits unset.


When was Bool Lagoon Game Reserve created?

Bool Lagoon Game Reserve was created in 1967.


How do you pronounce Boole?

Boole is pronounced as "bool" with a long 'u' sound.