60 likes | 224 Views
Things to Remember in C++. CSC 331. Note:. A character in C++ can be interpreted as a small integer (between 0 and 255). For this reason, C++ often treats a character like an integer. Note:.
E N D
Things to Remember in C++ CSC 331
Note: A character in C++ can be interpreted as a small integer (between 0 and 255). For this reason, C++ often treats a character like an integer.
Note: In C++ the Boolean constants are true and false. Additionally, following traditional standards, any nonzero number is considered true, and zero is considered false.
Note: When a variable is defined, it is not initialized. The programmer must initialize any variable requiring prescribed data when the function starts.
Java initialization • Default initial values. • Integer: 0 • Floating point: 0.0 • Char: \u0000. • Boolean: false • Reference: null • Note: Unlike C++ these values will be given to all variables that are members of a class; however, local variables within a method that aren’t initialized will cause a compile-time error (unlike C++).
Note: In C++ If a value is zero, it can be used as the logical value false. If a value is not zero, it can be used as the logical value true. Zero <===> False Nonzero <===> True