
please wait
|
|
#include <cstdint>
and int8_t
typestd::cout << static_cast<int>(result); //Will take another 4 bytes in memory
|
|
char x, y;
can translate into one byte of data, three bytes of pasdding, one byte of data, three byts of padding.int_least8_t
Note that operation with anything aside int will likely be slower, as int usually thranslates into native CPU register size.
cout << static_cast<int> (result) ;
Name Description Size* Range* char Character or small integer. 1byte signed: -128 to 127 unsigned: 0 to 255 |
An exception to this general rule is the char type, which exists by itself and is considered a different fundamental data type from signed char and unsigned char, thought to store characters. You should use either signed or unsigned if you intend to store numerical values in a char-sized variable. |