This answer is restricted. Please login to view the answer of this question.Login Now
A literal is a value that is expressed as itself. For example, the number 25 or the string “Hello World” are both literal.
A constant is a data type that substitutes a literal. Constants are useful in situations where
A variable in a program can change its value during the course of execution of the program. A constant retains the same value throughout the program.
For example, if you have a constant named PI that you’ll be using at various places in your program to find the area, circumference, etc of a circle, this is a constant as you’ll be reusing its value. But when you’ll be declaring it as:
const float PI = 3.141;
The 3.141 is a literal that you’re using. It doesn’t have any memory address of its own and just sits in the source code whereas PI is a constant of decimal type. It has a memory address also.
Requirement of Data type in c:
Data types used in C language refer to an extensive system that we use to declare various types of functions or variables in a program. Here, on the basis of the type of variable present in a program, we determine the space that it occupies in storage, along with the way in which the stored bit pattern will be interpreted.
A data type specifies the type of data that a variable can store such as integer, floating, character, etc.
Whenever we utilize a data type in a C program, we define the variables or functions used in it. We do so because we must specify the type of data that is in use so that the compiler knows exactly what type of data it must expect from the given program.
Click here to submit your answer.