C Constants and Literals

C Constants and Literals


C is a strongly typed language. This means that the variable type cannot be changed once it is declared. For example:

int number = 5;      // integer variable
number = 5.5;        // error
double number;       // error

Here, the type of number variable is int. You cannot assign a floating-point (decimal) value 5.5 to this variable. Also, you cannot redefine the data type of the variable to double. By the way, to store the decimal values in C, you need to declare its type to either double or float.