C++ Program to Find ASCII Value of a Character

In this program, we will discuss how to find the ASCII value of a character using the C++ programming language.

What is ASCII value?

It stands for American Standard Code for Information Interchange which is a numerical representation of characters in computers ranging from 0 to 127.

A character variable holds ASCII value rather than that character itself in C++ programming language.

For example, Character ‘A’ is represented by 65.

What this means is that, if you assign ‘A’ to a character variable, 65 is stored in that variable rather than ‘A’ itself.

C++ Programming Code to find ASCII value of a character

In this program, we will ask for a character from the user and then print its ASCII value.



using namespace std;

int main (){
    char c;
    cout << "Enter a character : ";
    cin >> c;

    cout << "ASCII value of " << c <<" is :  " << (int)c;

    return 0;


Enter a character : S
ASCII value of S is : 83

You can learn about many other C++ Programs Here.

Best Books for learning C++ programming language with Data Structure and Algorithms.

The following two tabs change content below.

Amit Rawat

Founder and Developer at SpiderLabWeb
I love to work on new projects and also work on my ideas. My main field of interest is Web Development.

You may also like...