C++ long Keyword
Example
Store large whole numbers with long and long long:
long myNum = 2000000000;
long long myBigNum = 9000000000;
cout << myNum << "\n";
cout << myBigNum;
Definition and Usage
The long keyword makes an integer type at least 32 bits long. It can store whole numbers from about -2 billion to 2 billion, or more. long is the same as long int.
Use long long for even bigger numbers. It is at least 64 bits long.
The size of long is different on different computers. On some computers it is 32 bits, and on others it is 64 bits.
Related Pages
Read more about data types and numbers in our C++ Numeric Data Types Tutorial.