Home   |   About   |   Terms   |   Contact    
Read & Learn
 

Signed char and Unsigned char in C++

C++

☯ All C++ Articles     ☯ All Articles


A new product.




Popular Google Pages:



◕ This article is regarding Signed char and Unsigned char in C++.
Last updated on: .



◕ What is Signed char and Unsigned char in C++?

- We know integer has the property Signed and Unsigned.
But, character is not Signed or Unsigned by default.
It depends on the Implementation or on the C++ Compiler Developer.



It depends on me whether I want to use character as Signed or Unsigned.
The example codes are given bellow:

▨ char bud; // may be signed, may be unsigned

▨ unsigned char flower; // definitely unsigned

▨ signed char bird; // definitely signed

If we use the char as numeric type then
- the signed char type typically represents from the range -128 to 127.
- the unsigned char type typically represents the range 0 to 255.

This means if we want to use a char as variable to hold values as large as 200.
Then we have to use unsigned char for its successful use on any system.



Related articles:
Integer Type in C++
Rules for Variable Names
Variable in C++
Fundamental Data Types & Compound Data Types
What is called Directive and Header File in C++ ?
What is Block Statement in C++ ?




Popular Google Pages:



Top of the page

Amazon & Flipkart Special Products

   


Top of the page