Constants In C Language

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.

6 thoughts on “Constants In C Language”

  1. 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.

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

  3. I was very pleased to seek out this net-site.I wished to thanks in your time for this excellent learn!! I definitely having fun with every little bit of it and I’ve you bookmarked to check out new stuff you weblog post.

  4. Hi this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

Leave a Comment