C++ Program to Find ASCII Value of a Character
In this example, you will learn to find the ASCII value of a character in C++.
A character variable holds ASCII value (an integer number between 0 and 127) rather than that character itself in C programming. That value is known as the ASCII value.
For example, the ASCII value of ‘A’ is 65.
What this means is that, if you assign ‘A’ to a character variable, 65 is stored in that variable rather than ‘A’ itself.
using namespace std;
cout << “Enter a character: “;
cin >> c;
cout << “ASCII Value of ” << c << ” is ” << int(c);
Enter a character: p
ASCII Value of p is 112