I have this constant:
#define MAX_DATE 2958465L
What does the L mean in this sense?
I have this constant:
#define MAX_DATE 2958465L
What does the L mean in this sense?
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).
In this scenario the L
does 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.
L tells the compiler that the number is of type Long. Long is a signed type greater than or equal to an int in size. On most modern compilers, this means that the number will take 4 bytes of memory. This happens to be the same as an int on most compilers so it won't have an effect in this case.
see this link it says :
Literal constants (often referred to as literals or constants) are invariants whose values are implied by their representations.
base:decimal
example:1L
description: Any decimal number (digits 0-9) not beginning with a 0 (zero) and followed by L or l