Constants In C Language

Constants In C Language

A constant is an identifier that refers to the fixed values that do not change during the execution of a program.

Declaring constants :
We can declare constant variable using constkeyword.

Example (syntax) :

type const variable_name = value; 
constant float const pi = 3.14;
int const a = 5;
Symbolic Constants :
Symbolic Constant is a name that substitutes for a sequence of a characters or a numeric constant, a character constant or a string constant.

Syntax :

#define name text;
* Name implies symbolic name in a caps
* Text implies value or the text.

Example :

#define printf print
#define MAX 100
The # character is used for preprocessor commands. A preprocessor is a system program, which comes into action prior to the compiler and it replaces the replacement text by the actual text.
That’s all with the constants in c language. Let’s see more with c language in the coming posts.

3 thoughts on “Constants In C Language

  1. Vikas

    November 21, 2017 3:00

    usefull information

  2. Donovan Hebner

    March 11, 2018 3:39

    Hey there! Someone in my Myspace group shared this website with us so I came to look it over. I’m definitely loving the information. I’m bookmarking and will be tweeting this to my followers! Great blog and great design.

  3. Jeffery Feng

    May 30, 2018 1:01

    I just got done eating a platter of spaghetti before visiting your site. It sure makes the full feeling all that much better.

Write your comment Here