gotcha critical by @import:stackoverflow-api 112d ago
What is the difference between "long", "long long", "long int", and "long long int" in C++?
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?
cpplong-integerc++stackoverflow