The constants refer to fixed values which may not be altered by the programme during its execution. Such fixed values are also known as literals. Constants, such as an integer constant, a floating constant, a character constant, or a string literal, may be any of the common data types. There are also constants in enumeration as well.
Except that their values can not be changed after their definition, the constants are treated just like normal variables.
A decimal, or hexadecimal constant, may be a literal integer. For hexadecimal, a prefix defines base or radix: 0x or 0X, and for decimal, there is no prefix I d.
An integer literal may also have a suffix, for unsigned and long, respectively, which is a combination of U and L. The suffix may be in any order and can be uppercase or lowercase. Examples -
A literal floating-point has an integer part, a decimal point, a fractional part, and a part of the exponent. Floating point literals can be expressed either in decimal or in exponential form.
You must include the decimal point, the exponent, or both when rendering in decimal form; and you must include the integer part, the fractional part, or both when rendering using exponential form. By e or E, the signed exponent is added.
In single citations, character literals are enclosed. 'a’ and can, for example, be stored in a simple char type variable. A simple character (such as 'a’), an escape sequence (such as '\t'), or a universal character can be a literal character.
When they are followed by a backslash, there are some characters in C #. They have special definitions and are used as newline (\n) or tab (\t) for representation. Here, some of these escape sequence codes are mentioned.
\\ \ character
\' ' character
\" " character
\? ? character
\a Alert or bell
\f Form feed
\r Carriage return
\t Horizontal tab
\v Vertical tab
\xhh . . . Hexadecimal number of one or more digits
The literals or constants of the string are enclosed in double quotes " or with @'.' A string includes characters identical to literal characters: simple characters, sequences of escape, and universal characters.
Using string literals and splitting the pieces using whitespaces, you can split a long line into several lines.
"Say, " "h" "i"
The constants are described using the keyword const. The syntax used to describe a constant is
const <data_type> <constant_name> = value;