Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

I have this constant:

#define MAX_DATE  2958465L 

What does the L mean in this sense?

like image 533
Tony The Lion Avatar asked Jun 02 '10 13:06

Tony The Lion


People also ask

What is L after number in C?

The C Programming Language says: An integer constant like 1234 is an int . A long constant is written with a terminal l (ell) or L , as in 123456789L ; an integer constant too big to fit into an int will also be taken as a long .

Why is L used for integer in R?

Because R's integers are 32-bit long integers and "L" therefore appears to be sensible shorthand for referring to this data type.

What is L in coding?

The l-value expression designates (refers to) an object. A non-modifiable l-value is addressable, but not assignable. A modifiable l-value allows the designated object to be changed as well as examined.

What is meant by integer literal?

Integer literals are numbers that do not have a decimal point or an exponential part. They can be represented as: Decimal integer literals. Hexadecimal integer literals. Octal integer literals.


2 Answers

It is a long integer literal.

Integer literals have a type of int by default; the L suffix gives it a type of long (Note that if the value cannot be represented by an int, then the literal will have a type of long even without the suffix).

like image 69
James McNellis Avatar answered Sep 22 '22 03:09

James McNellis


In this scenario the Ldoes nothing.

The L after a number gives the constant the long type, but because in this scenario the constant is immediately assigned to an int variable nothing is changed.

like image 24
orlp Avatar answered Sep 24 '22 03:09

orlp