Member-only story
The 4 C++ Type Modifiers: short, long, signed and unsigned
short type Modifier
We can use short for small integers, ranging from -32,767 to 32,767. Short is equivalent to 'short int’.
// small integer
short a = 12345;
long type Modifier
We can use long for large integers, ranging from in the range -2147483647 to 2147483647. Long is equivalent to ‘long int’.
// large integer
long b = 123456;
signed Modifier
Signed variables can hold both positive and negative integers including zero. By default, integers are signed. signed can only be used with int and char types.
// positive valued integer
signed int x = 23;
// negative valued integer
signed int y = -13;
// zero-valued integer
signed int z = 0;
unsigned type Modifier
The unsigned variables can hold only non-negative integer values. unsigned can only be used with int and char types.
// positive valued integer
unsigned int x = 2;
unsigned int y = 0;
To learn more about datastructures and algorithms:
Coursera — Algorithms Specialization (Stanford )
Coursera — Datastructures and Algorithms (HSE)
Coursera — Java Programming and Software Engineering Fundamentals (Duke University)
Coursera — Data Structures and Algorithms Specialization (UCSD)