How to Convert ASCII Value into char in C++? Last Updated : 21 May, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report In C++, ASCII (American Standard Code for Information Interchange) values are numerical representations of characters that are used in the C++. In this article, we will learn how to convert an ASCII value to a char in C++. Example: Input: int asciiValue = 65; Output: Character for ASCII value 65 is: 'A'Convert ASCII Value to char in C++To convert an ASCII value to a char, we can simply type-cast an integer (ASCII value) to a char type or directly use the char() function, which basically performs the same operation as type casting. Syntax to Convert ASCII to Char in C++char charName = (char)asciiValue; //typecasting to char type //or char charName = char(asciiValue); //directly using char() functionC++ Program to Convert ASCII to CharThe below program demonstrates how we can convert an ASCII value to a char in C++. C++ // C++ program to convert ASCII to char #include <iostream> using namespace std; int main() { // Define ASCII values for characters 'A' and 'B'. int asciiValue1 = 65; int asciiValue2 = 66; // Typecast the ASCII values to char type char character1 = (char)asciiValue1; cout << "The character for ASCII value " << asciiValue1 << " is " << character1 << endl; // use char() function tfor conversion char character2 = char(asciiValue2); cout << "The character for ASCII value " << asciiValue2 << " is " << character2 << endl; return 0; } OutputThe character for ASCII value 65 is A The character for ASCII value 66 is B Time Complexity: O(1)Auxilliary Space: O(1) Comment More infoAdvertise with us Next Article How to Convert a C++ String to Uppercase? D dahiyasourabh444 Follow Improve Article Tags : C++ Programs C++ CPP Examples Practice Tags : CPP Similar Reads How to Convert Char Array to Int in C++ In C++, a character array is treated as a sequence of characters also known as a string. Converting a character array into an integer is a common task that can be performed using various methods and in this article, we will learn how to convert char array to int in C++. Example Input:char arr1[] ="1 2 min read How to Convert a std::string to char* in C++? In C++, strings are the textual data that is represented in two ways: std::string which is an object, and char* is a pointer to a character. In this article, we will learn how to convert a std::string to char* in C++. Example Input:string myString = "GeeksforGeeks";Output:char * myString = "Geeksfor 1 min read How to Convert a Single Character to String in C++? A string is a generally made up of a sequence of multiple characters. In this article, we will learn how to convert a single character to a string in C++.Example:Input: c = 'A'Output: s = "a"Explanation: Character c is converted to a string.Input: c = '#'Output: s = "#"Explanation: Character c is co 4 min read Convert String to Char Array in C++ In C++, we usually represent text data using the std::string object. But in some cases, we may need to convert a std::string to a character array, the traditional C-style strings. In this article, we will learn how to convert the string to char array in C++.ExamplesInput: str = "geeksforgeeks"Output 4 min read How to Convert a C++ String to Uppercase? Converting a string to uppercase means changing each character of the string that is in lowercase to an uppercase character. In the article, we will discuss how to convert a string to uppercase in C++.ExamplesInput: str = "Geeksforgeeks"Output: GEEKSFORGEEKSExplanation: Every character of string con 3 min read Convert char* to std::string in C++ Strings are generally represented as an instance of std::string class in C++. But the language also supports the older C-Style representation where they are represented as array of characters (char* or char[]) terminated by null character '\0'. In this article, we will learn how to convert the char* 3 min read Like