What are Symbolic Constant and its advantages in C Programming | Allinonetuts

What are Symbolic Constant and its advantages in C Programming?

Symbolic Constant:

A symbolic constant is a name that substitutes for a sequence of characters. The characters may represent numeric constant, a character constant or a string constant. Thus, a symbolic constant allows a name to appear in place of a numeric constant, a character constant or a string.

Declaration of Symbolic Constant:

A symbolic constant is declared as follows:

#define symbolic_name value of constant

Valid examples of constant definitions are

#define  STRENGTH       100

#define   PASS_MARK    50

#define   MAX                   200

#define   Pl                        3.14159

Symbolic constants are sometimes called constant identifiers. Since the symbolic names are constants they do not appear in declarations. The following rules apply to the #define statement which defines a symbolic constant.

  1. Symbolic names have the same form as variable names. (Symbolic names are written in CAPITALS to visually distinguish them from the normal variable names which are written in lowercase letters. This is only a convention, not a rule.)
  2. No blank space between the pound sign and the word define is permitted.
  3. #define student must not end with a semicolon.
  4. A blank space is required between ^define and symbolic name and between the symbolic name and constant
  5. Symbolic names are not declared for data types.

Advantages of Symbolic Constant:

  1. It makes the programs easier to understand and readable.
  2. It makes the programs more powerful.
  3. It makes the program modification easier.
  4. Their use is recommended since, they contribute to the development of clear, orderly program.
    For example, symbolic constants are more readily identified than the information that they represent, and the symbolic names usually suggest the significance of their associated data items.

Click Here:  To Learn about token in c programming

Hope you like this article! if you really like this article so you are requested to give us a small review by selecting above stars according to our website!

Hello Viewers,
welcome to the Allinonetuts a Technical tutorial and Programming Blog Maintained by Vikas Kardam, a Web Developer and Blogger From Delhi, India.
What are Symbolic Constant and its advantages in C Programming? was last modified: July 1st, 2017 by Vikas Kardam
Submit your review

Create your own review

Average rating:  
 1 reviews

Nice Article for learning C Programming

Leave a Reply

Your email address will not be published. Required fields are marked *