Signed Value Ranges
Signed Value Ranges
Definition :
A signed integer or a signed character is a data type in computer
programming that can represent both positive and negative values.
The “signed “ keyword is used to indicate that the data type ca hold
negative numbers in addition to positive numbers
Example 1 Example 2
1. Starting from the right, find the
00101001 00101100
first "1"
2. Invert all of the bits to the left of
11010111 11010100
that "1"
The difference between signed character,
short and long integers
• The difference between signed char , signed short int(often referred
to as short), and signed long int (often referred to as long) lie in their
memory size and range of values they can represent:
• Size/Type Range
• 8 bit signed -128 to 127
• 16 bit signed -32,768 to 32,767
• 32 bit signed -2,147,483,648 to 2,147,483,647
The formula to use?
•Formula to use:
•Range = (-(2^(n-1))) to (2^(n-1) - 1)
Example: