In some cases we use long long in C or C++. Here we will see what is basically long long is? The long long takes twice as much memory as long. In different systems, the allocated memory space differs. On Linux environment the long takes 64-bit (8-bytes) of space, and the long long takes 128-bits (16-bytes) of space. This is used when we want to deal with some large value of integers.
We can test the size of different types using this simple program.
Example
#include <iostream> using namespace std; main() { int a; long b; long long c; cout << "Size of int = "<< sizeof(a) <<" bytes \n"; cout << "Size of long = "<< sizeof(b) <<" bytes\n"; cout << "Size of long long = "<< sizeof(c) <<" bytes\n"; }
Output
Size of int = 4 bytes Size of long = 4 bytes Size of long long = 8 bytes
Output may differ in different systems. Here windows platform is used for testing.