uint8_t can't be printed with cout

前端 未结 8 2165

I have a weird problem about working with integers in C++.

I wrote a simple program that sets a value to a variable and then prints it, but it is not working as expe

8条回答
  •  猫巷女王i
    2020-11-21 14:00

    Adding a unary + operator before the variable of any primitive data type will give printable numerical value instead of ASCII character(in case of char type).

    uint8_t aa = 5;
    cout<<"value is "<< +aa <

提交回复
热议问题