Long Keyword


In C programming, the 'long' keyword is used to declare variables that hold integer values with a wider range and greater precision than 'int'.

The 'long' keyword extends the range of representable values for integers.

Here's an example of using the 'long' keyword to declare a variable:


long population = 7500000000L;

    

In this example, the 'long' keyword is used to declare a variable named 'population' and initialize it with the value 7500000000.

The 'L' suffix indicates that the literal value is of type 'long'.

'long' variables are commonly used when dealing with large numbers or when a wider range of values is required.

It's important to note that the size of 'long' can vary across different platforms and compilers. It typically occupies more memory than 'int'.

To ensure consistency, you can use 'long long' if you require an even wider range of values.

Loading...

Search