Types of C Literals

There are 4 types of literal in C:

  • Integer Literal
  • Float Literal
  • Character Literal
  • String Literal

Literals in C

In C, Literals are the constant values that are assigned to the variables. Literals represent fixed values that cannot be modified. Literals contain memory but they do not have references as variables. Generally, both terms, constants, and literals are used interchangeably. 
For example, “const int = 5;“, is a constant expression and the value 5 is referred to as a constant integer literal.

Similar Reads

Types of C Literals

There are 4 types of literal in C:...

1. Integer Literals

Integer literals are used to represent and store the integer values only. Integer literals are expressed in two types i.e....

2. Floating-Point Literals

...

3. Character Literals

These are used to represent and store real numbers. The real number has an integer part, real part, fractional part, and exponential part. The floating-point literals can be stored either in decimal form or exponential form. While representing the floating-point decimals one must keep two things in mind to produce valid literal:...

4. String Literals

...