long double

We can use a long modifier with double datatype to create a long double variable. Long double is used to store significantly large decimal numbers which surpass the range of double. 

  • The size of a long double is 16 bytes.
  • It provides more accuracy, precision and a larger range than the standard double data type.
  • The format specifier for long double is %Llf.

Syntax of long double

long double var;

Example of long double

C




// C program to illustrate the long long int
#include <stdio.h>
  
int main()
{
    // declaring the long long int variable
    long double var;
  
    // printing the size of long double
    printf("Size of long double: %d", sizeof(long double));
  
    return 0;
}


Output

Size of long double: 16

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