Hi i a little confuse about fundmental data types
For example what is the diffrence between int and long int
They both 4 bytes and with the same range of numbers
And what is the range of the 3 floating point and the diffrences
Not all machines will use 4 bytes for a long, for example my red hat enterprise server responds with an 8 when the code encounters a call to sizeof(long)
I recommend the int type if you are unsure what to use, as this is usually the natural size for the processor your code is compiled on.
According to my book, Absolute C++, the range for floats is about 10^-38 to 10^38 with 7 digit precision.
Since all of your data, regardless of their type, is stored in computer memory as 1's and 0's it comes down to how the computer will treat that information when it reads it. For example, if you #include <stdio.h> and use printf("%d", x) then the compiler will expect x to be an integral decimal representation such as an int, and output what the binary value represents assuming it is an int. However, if it is actually a float the data is stored differently and it will not output what you would expect.