Computer Science, asked by naveenmajeed, 1 year ago

what is literals(constants)
please send answer immediatly​

Answers

Answered by Anonymous
1

✷Literals are data items that are fixed data values. It's value cannot be changed.

Answered by Hacket
0
literal is a token whose spelling directly contains the information that determines its type and value.

There are seven kinds of literals

Integer literals, such as 42, which have non-boolean integral type.

Character literals, such as 'x', which have type char, char16_t, char32_t, or wchar_t.

Floating literals, such as 3.14, which have floating-point type.

String literals, such as "Hello, world", which have array of constant character type (where a character type is again char, char16_t, char32_t, or wchar_t.)

The boolean literals true and false, which have type value.

The null pointer literal nullptr, which has type std::nullptr_t, which can be implicitly converted to the null pointer of any pointer type.

User-defined literals, which take the form of integer, character, floating, or string literals, but followed by a user-defined literal suffix that determines their type. These are an exception to the rule that a literal's spelling completely determines its type and value: you need to see the definition of the literal operator to know its type and value. User-defined literals can be thought of more like syntactic sugar than actual literals.
Similar questions