Keywords in C
Constants in C
Constant is an entity(input value) which does not change during execution of program and the value assigned is fixed throughout the program
Ex. int a=2, b=5; /*integer constant*/
Float d=10.60; /*Real constant*/
char ch= ‘d’; /*character constant*/
In this example a fixed value 2 assigned to a variable ‘a’ and value 5 is assigned to variable ‘b’ which is not going to be changed during the program execution, both values are of type integer each requires 2 bytes or 16 bits memory space .Similarly, the value 10.60 assigned to variable ‘d’ which is of type float and it requires 4 bytes of memory space. Also, variable ch is assigned with value ‘ d ’ of type character requires 1 byte of memory space.
There are two types of constants:
1. Primary Constants: Primary constants are again classified as integer (int), Real constants (float), Character constant (char).
These are the primary data types in C
2. Secondary constants: Secondary constants are again divided into the array, String, Structure,
Union, Enum
etc. Secondary
constants are also called as
derived constants because they are taking
the
help of the primary constants
for declaration.