How to Convert ASCII Value into char in C++? Last Updated : 21 May, 2024 Comments Improve Suggest changes 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 ASCII Value into char in C++? 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 How to Convert Hex String to Byte Array in C++? A Hex String is a combination of the digits 0-9 and characters A-F and a byte array is an array used to store byte data types only. The default value of each element of the byte array is 0. In this article, we will learn how to convert a hex string to a byte array. Example: Input: Hex String : "2f4a 2 min read How to Initialize Vector of Char Arrays in C++? In C++, a vector is a dynamic array that can grow and shrink in size. A char array is a sequence of characters, typically used to represent strings. In this article, we will learn how to initialize a vector of char arrays in C++. Example: myVector: {âappleâ, âbananaâ, âcherryâ}Initializing a Vector 2 min read Convert character array to string in C++ This article shows how to convert a character array to a string in C++. The std::string in c++ has a lot of inbuilt functions which makes implementation much easier than handling a character array. Hence, it would often be easier to work if we convert a character array to string. Examples: Input: ch 4 min read Convert Vector of Characters to String in C++ In this article, we will learn different methods to convert the vector of character to string in C++.The most efficient method to convert the vector of characters to string is by using string's range constructor. Letâs take a look at an example:C++#include <bits/stdc++.h> using namespace std; 2 min read Like