Lecture overview -- Keyboard shortcut: 'u'  Previous page: Fundamental types i C++ -- Keyboard shortcut: 'p'  Next page: Structs in C++ -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 2 - Page 3 : 42
Notes about C++
Basic facilities
Booleans

There is a type bool in C++

Boolean constants true and false

  • The C++ Programming Language: Page 71
 

  • Type bool in relation to other fundamental types

    • Boolean values are converted implicitly to integers in arithmetic and logical expressions: false to 0 and true to 1.

    • Integers can be converted implicitly to booleans: 0 to false, other values to true.

    • Pointers can implicitly be converted to boolean values as well

Under the hood the well-known C boolean conventions still apply