2-1 Note:
1, C + + only specifies the minimum size of each type of memory, while the number of bytes at least long long >=long>=int>=short;
2, the character type is divided into Char, signed char and unsigned char. The type char actually behaves as the above type, specifically determined by the compiler; VS2013, char = = signed char;
Suggestions:
1, clearly know that the value can not be negative, the use of unsigned type;
2, char only for storing characters, need a small integer, with signed char or unsinged char (clearly indicated);
3, the execution of floating point number with double (double with 2 words (64 bits) to represent precision);
2-2 Note:
1, non-bool->bool,0->false, non-0->true;
2, bool-> non-bool,false->0,true->1;
3. When assigning an unsigned type to a value that exceeds the range it represents, the result is that the initial value represents the remainder of the total number of numeric values for the unsigned type;
unsigned char =-1; (0~255);
Actual for -1%256 = 255; The remainder after modulo! 72235878
4. When we assign a symbol type to a value that exceeds the range it represents, the result is undefined!
Signed char c2 = 256; Assuming that Char occupies 8 bits, the value of C2 is undefined.
C + + Primer NOTE 2 Basic built-in types