C++ random output when using <cstdint>

53 Views Asked by At

I have the following code in my project:

#include <iostream>
#include <cstdint>
#include <queue>

int main()
{
    std::queue<uint8_t> queue;
    queue.push(5);
    std::cout << queue.front() << std::endl;

    int8_t value = 10;
    std::cout << value << std::endl;
}

And when I print any of those values of type uint8_t or int8_t I get random output. When I print values of any other integer type from the cstdint I get the expected output. Random output only appears when I print the 8 bit values.

Note: I'm new to c++ programming as I recently started learning it.

0

There are 0 best solutions below