1. Basics in C++

C++ Program to Find ASCII Value of a Character

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 ASCII value.

For example, 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.


#include <iostream>
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: p
ASCII Value of p is 112
Comments to: C++ Program to Find ASCII Value of a Character

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.


Welcome to WikiCoders

Join the site and store the save posts for later, share your own articles
Join WikiCoder
Registration is closed.