Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

1 Answer
Samual Sam

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.

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.