About & Social

0
Image result for constants in c
The C Character Set

A character denotes any alphabet, digit or special symbol used to represent information. Figure 1.1 shows the valid alphabets, numbers and special symbols allowed in C.

Figure 1.1
Figure: 1.1



Constants, Variables and Keywords

The alphabets, numbers and special symbols when properly combined from constants, variables and keywords. Let us see what are ‘constants’ and ‘variables’ in C. A constant is an entity that doesn’t change, whereas, a variable is an entity that may change.

In any program we typically do lots of calculations. The results of these calculations are stored in computer’s memory. Like human memory, the computer’s memory also consists of millions of cells. The calculated values are stored in these memory calls. To make the retrieval and usage of these values easy these memory cells (also called memory locations) are given names. Since the value stored in each location may change the names given to shown in Figure 1.2.

Here 3 is stored in a memory location and a name x is given to it. Then we have assigned a new value 5 to the same memory location x. This would overwrite the earlier value 3, since a memory location can hold only one value at a time.

http://gulpatutorial.blogspot.in/
Figure: 1.2




Since the location whose name is x can hold different values at different times x is known as a variable. As against this, 3 or 5 do not change, hence are known as constants.

Types of C Constants

C constants can be divided into two major categories:
a)     Primary Constants
b)     Secondary Constants

These constants are further categorized as shown in Figure 1.3.

http://gulpatutorial.blogspot.in/
Figure: 1.3


At this stage, we would restrict our discussion to only Primary constants, namely, Integer, Real and Character constants. Let us see the details of each of these constants. For constructing these different types of constants, certain rules have been laid down.
These rules are as under: Please wait...!!coming soon  4th Part


Post a Comment

Dear readers, after reading the Content please ask for advice and to provide constructive feedback Please Write Relevant Comment with Polite Language.Your comments inspired me to continue blogging. Your opinion much more valuable to me. Thank you.