![]() |
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() function C++ Program to Convert ASCII to CharThe below program demonstrates how we can convert an ASCII value to a char in C++.
Output The character for ASCII value 65 is A The character for ASCII value 66 is B Time Complexity: O(1) |
Reffered: https://www.geeksforgeeks.org
C++ |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 20 |