In computer programming, a constant is an identifier with an associated value which cannot be altered by the program during normal execution – the value is constant. This is contrasted with a variable, which is an identifier with a value that can be changed during normal execution – the value is variable. Constants are useful for both programmers and compilers: for programmers they are a form of self-documenting code and allow reasoning about correctness; while for compilers they allow compile-time and run-time checks that constancy assumptions are not violated, and allow or simplify some compiler optimizations.
There are various specific realizations of the general notion of a constant, with subtle distinctions that are often overlooked. The most significant are: compile-time (statically-valued) constants, run-time (dynamically-valued) constants, immutable objects, and constant types (const).
Typical examples of compile-time constants include mathematical constants, values from standards (here maximum transmission unit), or internal configuration values (here characters per line), such as these C examples:
[Kanye West]
All of the lights
All of the lights
All of the lights
[Drake]
Aaaaaalright it's on
I grew up thinking I was wrong
And always said if they let me in the b-tch
I'd do some damage
I might be out of mind
But if I am it's just in time
Because I got the extra nation so you f-cking understand it man
I'm already for n-gga but I
[Kanye West]
Something wrong
I hold my head