이름공간
변수
행위

불 리터럴

cppreference.com
< cpp‎ | language
 
 
C++ 언어
General topics
Flow control
Conditional execution statements
Iteration statements
Jump statements
Functions
function declaration
lambda function declaration
function template
inline specifier
exception specifications (deprecated)
noexcept specifier (C++11)
Exceptions
Namespaces
Types
decltype specifier (C++11)
Specifiers
cv specifiers
storage duration specifiers
constexpr specifier (C++11)
auto specifier (C++11)
alignas specifier (C++11)
Initialization
Literals
boolean literals
nullptr (C++11)
user-defined (C++11)
Expressions
alternative representations
Utilities
Types
typedef declaration
type alias declaration (C++11)
attributes (C++11)
Casts
implicit conversions
const_cast conversion
static_cast conversion
dynamic_cast conversion
reinterpret_cast conversion
C-style and functional cast
Memory allocation
Classes
Class-specific function properties
Special member functions
Templates
class template
function template
template specialization
parameter packs (C++11)
Miscellaneous
Inline assembly
 
 

목차

[편집] 문법

true (1)
false (2)

[편집] 설명

불 리터럴은 키워드 truefalse이다. 이들은 유형 prvalues이다.

[편집] Notes

See Integral conversions for implicit conversions from bool to other types and boolean conversions for the implicit conversions from other types to bool.

[편집] 예시

#include <iostream>
 
int main()
{
  std::cout << std::boolalpha
            << true << '\n'
            << false << '\n'
            << std::noboolalpha
            << true << '\n'
            << false << '\n';
}

Output:

true
false
1
0

[편집] See also

C documentation for Predefined Boolean constants