I am transitioning from Java to C++ and have some questions about the long
data type. In Java, to hold an integer greater than 232, you would simply write long x;
. However, in C++, it seems that long
is both a data type and a modifier.
There seems to be several ways to use long
:
long x;
long long x;
long int x;
long long int x;
Also, it seems there are things such as:
long double x;
and so on.
What is the difference between all of these various data types, and do they all have the same purpose?