Computer Science, asked by sandeepmorya1006, 1 year ago

Give the definition of C constant. Explain its types.

Answers

Answered by anshul395270
0
In computer programming, a constant is a value that cannot be altered by the programduring normal execution, i.e., the value is constant.[a] When associated with an identifier, a constant is said to be "named," although the terms "constant" and "named constant" are often used interchangeably. This is contrasted with a variable, which is an identifier with a value that can be changed during normal execution, i.e., the value is variable. Constants are useful for both programmers and compilers: for programmers they are a form of self-documenting code and allow reasoning about correctness; while for compilers they allow compile-time and run-time checks that constancy assumptions are not violated, and allow or simplify some compiler optimizations.
Answered by theking20
1

The definition of C constants and its types are as follows:

           The Constant is a specific type of data type in C, indicating the values defined in the can't be changed, once set. In a Constant is defined by the keyword 'const'.

There are different types of Constants;

• Integer Constants: It refers to whole digits

• Real Constant: It includes digits containing factorial parts (like, 92.53)

• Single Character Constant: It refers to a character within quotes (like, 'B')

• String Constant:  It refers to a sequence of characters (like, "Hey")

• Backslash Character Constant: This represents some sets of predefined Constant in C with a backslash (like, \n means new line)

Similar questions