long long int

We can even apply the long modifier to long int to further increase the size of the data type. The long long int is often used when the range of values exceeds the long data type.

  • The size of the long long int is 8 bytes.
  • It can represent integer values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
  • The format specifier for the long long data type is %lld.
  • The long int literals can be represented by a numeric value followed by “LL” or “ll” as the suffix.

Syntax of long long int

long long int var;

As with the long int, we can also declare long long int by only using long long keywords.

long long var;

Example of long long int

C




// C program to illustrate the long long int
#include <stdio.h>
  
int main()
{
    // declaring long long int variables using both ways
    long long int var1;
    long long var2;
  
    // printing the size of long long it
    printf("Size of var1: %d\nSizeof var2: %d",
           sizeof(var1), sizeof(var2));
    return 0;
}


Output

Size of var1: 8
Sizeof var2: 8

C Long

In C, the long keyword is a datatype modifier that can be applied to the basic datatypes to increase the range and size of values their variables can store. For example, a long int variable can store integer values that range from -2,147,483,648 to 2,147,483,647 which is significantly greater as compared to the normal int data type, which can store integer values that range from -32,768 to 32,767 in the 16-bit compiler.

Similar Reads

How to use long modifier?

We can apply the long modifier to the allowed data types just by adding it as a prefix in the normal variable declaration. For example:...

1. long  int

When long is applied to an integer it creates a long int, which increases the range of values that int can store. The long int is used when the range of values exceeds the int data type....

2. long long int

...

3. long double

We can even apply the long modifier to long int to further increase the size of the data type. The long long int is often used when the range of values exceeds the long data type....

When to Use long in C?

...

Contact Us