
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
Convert an int to ASCII character in C/C++
In C or C++ the character values are stored as ASCII values. To convert int to ASCII we can add the ASCII of character ‘0’ with the integer. Let us see an example to convert int to ASCII values.
Example
#include<stdio.h> int intToAscii(int number) { return '0' + number; } main() { printf("The ASCII of 5 is %d\n", intToAscii(5)); printf("The ASCII of 8 is %d\n", intToAscii(8)); }
Output
The ASCII of 5 is 53 The ASCII of 8 is 56
- Related Articles
- How to convert an int to string in C++?
- How do I convert a char to an int in C and C++?
- How to convert a single char into an int in C++
- C++ Program to Find ASCII Value of a Character
- Convert a string to hexadecimal ASCII values in C++
- Convert Hexadecimal value String to ASCII value String in C++
- How to convert a string into int in C#?
- C# Program to Convert Character case
- C++ Program to convert int Variables into double
- Convert the ASCII value sentence to its equivalent string in C++
- C++ Program to Convert long Type Variables to int
- C++ Program to Convert int Type Variables to long
- How to convert an integer to an ASCII value in Python?
- C++ Program to Convert int Type Variables into String
- C++ Program to convert double type Variables into int

Advertisements