I am trying to read a small integer value (less than 10) to a uint8_t variable. I do it like this
uint8_t myID = atoi(argv[5]);
However when I do this
std::cout << "My ID is "<< myID <<std::endl;
It prints some non-alphanumeric character. There is no issue when myID is of type int. I tried casting explicitly by doing
uint8_t myID = (uint8_t)atoi(argv[5]);
But the results are the same. Could anyone explain why this is the case and if there is any possible solution?