Clarification Needed!!
So I'm on variables now on my quest to learning the basics of cpp.
I need clarification on the types of variables and data types there are.
For example,
what kind of case would need a floating integer?
It just doesn't click in my head.
Err? Rephrase that question..i'm not sure what you mean.
All integer types come in two varieties: signed and unsigned. The idea here is that sometimes you need negative numbers, and sometimes you don't. Integers (short and long) without the word "unsigned" are assumed to be signed. Signed integers are either negative or positive. Unsigned integers are always positive.
Because you have the same number of bytes for both signed and unsigned integers, the largest number you can store in an unsigned integer is twice as big as the largest positive number you can store in a signed integer. An unsigned short integer can handle numbers from 0 to 65,535. Half the numbers represented by a signed short are negative, thus a signed short can only represent numbers from -32,768 to 32,767.
Several other variable types are built into C++. They can be conveniently divided into integer variables (the type discussed so far), floating-point variables, and character variables.
Floating-point variables have values that can be expressed as fractions--that is, they are real numbers. Character variables hold a single byte and are used for holding the 256 characters and symbols of the ASCII and extended ASCII character sets.
__________________________________________________ ________
Format:
[VariableType] == [Size (may vary)] == [what number it can go down/up to]
unsigned short int == 2 bytes == 0 to 65,535
short int == 2 bytes == -32,768 to 32,767
unsigned long int == 4 bytes == 0 to 4,294,967,295
long int == 4 bytes == -2,147,483,648 to 2,147,483,647
int (16 bit) == 2 bytes == -32,768 to 32,767
int (32 bit) == 4 bytes == -2,147,483,648 to 2,147,483,647
unsigned int (16 bit) == 2 bytes == 0 to 65,535
unsigned int (32 bit) == 2 bytes == 0 to 4,294,967,295
char == 1 byte == 256 character values
float == 4 bytes == 1.2e-38 to 3.4e38
double == 8 bytes == 2.2e-308 to 1.8e308