Short answer
Yes. In C and C++, char is an integer type, so you can convert it to an int with an assignment, a cast, or arithmetic. What you get depends on what you want: the character’s code, or the digit it stands for.
A char is a small integer
A char holds a character code. On systems that use ASCII, the letter 'A' is stored as 65. Because char is an integer type, it converts to int without any special function.
Getting the character code
Assigning a char to an int gives you its code:
char letter = 'A';
int code = letter; // 65 on systems that use ASCII
Getting the digit value
If the char holds a digit from '0' to '9', subtract '0'. The language requires the digit characters to have consecutive values, so ch - '0' gives the digit’s value for each one:
#include <iostream>
int main() {
char ch = '7';
int code = ch; // the character code, 55 on ASCII systems
int digit = ch - '0'; // the number 7
std::cout << code << ' ' << digit << '\n'; // prints 55 7
}
The mistake to avoid
int n = '7'; doesn’t store 7. The single quotes make it a character, so n holds the character’s code, which is 55 on ASCII systems. To turn a digit character into its number, use subtraction as shown above.
Casting explicitly
You can write the conversion explicitly. In C++, static_cast<int>(ch) does the same thing as int code = ch;. In C, (int)ch works. An explicit cast can make the intent clearer to someone reading the code.
Signedness and other values
Whether char is signed depends on the compiler and platform. For digits and common letters, that difference doesn’t matter. It matters for values outside ASCII, such as bytes above 127. For the rules on signed and unsigned values, see signed vs unsigned in c. If you’re handling raw bytes, reading them as unsigned char avoids surprises.
When you need more than one character
A single char is one job. A whole string of digits is another, and it needs a different approach. For that, see c convert string to int. For a broader walkthrough of char-to-int conversion, read the c char to int guide.
Summary
Yes, a char converts to an int. Assigning it gives you the character code, and subtracting '0' gives you a digit’s value. Keep those two results apart, and remember that '7' is not the number 7.