What does the “L” mean at the end of an integer literal?

In many programming languages, including C and C++, the “L” suffix at the end of an integer literal indicates that the literal is a long integer type.

For example, the following code defines a variable x with a value of 12345, and specifies that the type of x is long int:

java

long int x = 12345L;

Without the L suffix, the literal 12345 would be interpreted as an int type by default, which may have a different size and range depending on the implementation. By explicitly specifying the long int type with the L suffix, you ensure that the variable x has a consistent size and range across different implementations.

Note that in C++, you can also use the LL suffix to indicate a long long int type, which is an even larger integer type. For example:

java

long long int x = 12345LL;

In C++11 and later, you can also use the ' suffix to indicate a long long int type.