Is putting in binary as a value possible?
I want something like char test = 00101011
, and it will become 43. I know this is possible by making a function that converts binary to decimal (which can be inputted), but that’s not direct, and I’m pretty sure it takes time.
You need to put the prefix 0b
.
#include <iostream>
int main()
{
char c = 0b00101011;
std::cout << static_cast<int>(c) << std::endl;
}