ASCII Value Of Character In C++ | Programming - PrepInsta

lock

Unlock this article for Free, by logging in

Don’t worry, unlock all articles / blogs on PrepInsta by just simply logging in on our website

C++ Program to print ASCII value of a character

October 14, 2022

To find ASCII value of a Character in C++

Here, on this page we will discuss the program to find the ASCII value of a character in C++ .The variable of char data type can hold basically three types of characters. These characters can be differentiated on the basis of ASCII value which have been assigned to them.

ASCII value of a character in C++ While loop in C

Did you know?

 ASCII stands for American Standard Code for Information Interchange
  • Which is a binary code used by electronic equipment for electronic communications
  • A total of 128 characters have been assigned values from 0 – 127
  • Alphabets (  65 – 90  &  97 – 122  )
  • Digits (  48 – 57  )
  • Remaining are Special Character (  !, @, #, $, * …..)

Working

  • User gives an input
  • Input is stored in a char type variable say val.
  • val is converted from char to int .
  • The ASCII value of Character is Obtained
ASCII Value of a character

C code

Run //C++ program to calculate ASCII value of Character #include <iostream> using namespace std; //main program int main() { char val='z'; //printing the ASCII value of input //through typecasting cout<<"The ASCII value of "<<val<<" is "<<(int)val; return 0; }

Output

The ASCII value of z is 122 Related Pages Juggling algorithm for array rotation Balanced Parenthesis Problem 

Toggle each character in a string

Count the number of vowels

Length of the string without using strlen() function

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get Prime

For similar question click on given button.

Top 100 Questions Software Engineering SDLC ×
30+ Companies are Hiring

Get Hiring Updates right in your inbox from PrepInsta

Select your Passing out Year 2022 2023 2024 2025 2026 2027 2028 2029 Others Get Hiring Updates

Tag » How To Get Ascii Value Of Char In C++