English

Why is char often treated as an integer data type?

Advertisements

Question

Why is char often treated as an integer data type?

Short/Brief Note
Advertisements

Solution

Character data type accepts and returns all valid ASCII characters. The character data type is often said to be an integer type since all the characters are represented in memory by their associated ASCII Codes. If a variable is declared as char, C++ allows storing either a character or an integer value.

shaalaa.com
Data Types
  Is there an error in this question or solution?
Chapter 9: Introduction to C++ - Data Types, Variables and Expressions - Evaluation - Section - B [Page 150]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 11 TN Board
Chapter 9 Introduction to C++
Data Types, Variables and Expressions - Evaluation - Section - B | Q 3. | Page 150
Advertisements
Share
Notifications



      Forgot password?
Use app×