Lecture+06 TypesVarsConsts
Lecture+06 TypesVarsConsts
Literals, Constants
What is in a Word?
• Casting, or conversion
– Needed when different type expected
– Compiler handles automatically
• Bool
– LHS = {false if 0, true if non-0}
– RHS = {0 if false, 1 if true}
Type Conversion
• Boolean
true
false
• Pointer
– nullptr ← preferred literal
– 0
– NULL (must #include cstdlib)
– Never any other
Variables