unsigned char to int in C++

c++, casting, unsigned

Solution

unsigned char c = 40;
int i = c;

Presumably there must be more to your question than that...

Problem

I have a variable unsigned char that contains a value, 40 for example. I want a int variable to get that value. What's the simplest and most efficient way to do that? Thank you very much.

Original source