Constants are fixed values that the programme cannot change while it is running. Literals are another name for these fixed values. Integer constants, character constants, floating constants, and string literals are all examples of basic data types. There are also enumeration constants. Constants are processed similarly to ordinary variables, with the exception that their values cannot be changed after they have been defined.
A decimal, octal, or hexadecimal constant can be used as an integer literal. The base or radix of a number is specified by a prefix: 0x or 0X for hexadecimal, 0 for octal, and nothing for decimal. A suffix that is a mix of U and L, for unsigned and long, can be added to an integer literal. The suffix can be capitalised or capitalised, and it can appear in any sequence.
An integer portion, a decimal point, a fractional part, and an exponent part make up a floating-point literal. Floating point literals can be represented in decimal or exponential form. You must include the decimal point, the exponent, or both when representing decimal form, and you must include the integer portion, the fractional part, or both when representing exponential form. e or E introduces the signed exponent.
Single quotes are used to surround character literals, so 'x' can be kept in a simple char variable. Certain letters in C, such as newline (\n) and tab (\t), have unique significance when preceded by a backslash.
Double quotes "" are used to surround string literals or constants. Plain characters, escape sequences, and universal characters are among the characters in a string that are similar to character literals. String literals can be used to split a large line into many lines and white spaces can be used to separate them.
There are two simple ways to define constants in C.