Hit enter after type your search item

Find ASCII Value of a Character in C++ [2 Programs]

What is ASCII value?

  • ASCII stands for American Standard Code for Information Interchange.
  • A character or special character holds ASCII value rather than the character itself.
  • The ASCI value is an integer value between 0 and 127
  • The ASCII character set consists of English letters from A-Z, a-z, numbers 0-9, and a few special characters like an exclamation mark (!), dollar sign ($), plus (+), an asterisk (*), etc.

How to find ASCII characters in C++

In C++ programming, the value contained in a character variable is the ASCII value, not the value itself.

For example, consider a char type variable “chr”:

chr = ‘A’

the chr contains ASCII value 65 which is the ASCII value of character A.

An example to find ASCII value in C++

In the first program, we will find the ASCII value of a few characters. These include:

  • A
  • a
  • 0
  • 9
  • Z
  • z
  • ;
  • *

See the code and output:



In the above program, the int() is used to convert a character to its ASCII value.

Getting 0-255 ASCII values character example

In this program, we will find all the characters for the corresponding ASCII value. For this, a for loop is used and it will iterate from 0 to 255 value.

In each iteration, the corresponding ASCII value to its character is displayed. Have a look:




This div height required for enabling the sticky sidebar