C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

Code Snippets C/C++ Code Snippets

C++ program to print ASCII value of a character.

By: IncludeHelp, On 11 OCT 2016

In this program we will learn how to print ASCII value of a character?

In this program there is a character type variable x which has "A", we can print the ASCII value of "A" by converting the type of value x.

C++ program (Code Snippet) - Get ASCII of a Character

Let’s consider the following example:

/*C++ program to print ASCII value of a character*/


using namespace std;

int main(){
	char x;
	cout<<"ASCII value of "<<x<<" is "<<(int)x<<endl;
	return 0;


    ASCII value of A is 65