I wanted to put some small integers into an array and decided to use int8_t:
#include <cstdint>
#include <iostream>
int main() {
int n = 3;
int8_t arr[n];
for (int i = 0; i < n; ++i) {
std::cin >> arr[i];
}
}
Input is 9 -20 14 and n = 3.
But instead of 9, -20, 14 in array I got 9, -, 2.
Why does int8_t act like a char?
P.S. int8_t is typedef'd in sys/types.h this way:
# define __intN_t(N, MODE) \
typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
# ifndef __int8_t_defined
# define __int8_t_defined
__intN_t (8, __QI__);
# endif