Wednesday, 19 February 2014

What is a constant,variable and keyword in C?

To learn C Language at first we need clear idea on What is a constant,variable and keyword in C?
Constant:

Constant refers to the fixed value that do not change during the execution of program. A constant may be number , character or character string that can be used as a value in a program. To use constant to reprent integer,floating point or charcter value that can not be modified.
       Constant divided into two major categories

Primary constant—integer,real,character

Secondary constant-array,pointer,structure,union,enum.


Variable:
A constant is an entity that does not change whereas variable is an entity that change during execution of program.

       In any program we typically do lots of calculations. The results of these calculations are stored in computers memory. Like human memory the computer memory also consists of millions of cells. The calculated values are stored in these memory cells. 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 these locations are called variable names.


X=3
X is variable that store the value in his memory location.3 is constant

Now
X=5
Variable can change the value now .

Keywords
In c language some special words or character are defined by default that is called keyword.each keyword have own special mean in program.Keywords are special word that can not be used as variable name.

Here some flowing words are keywords

auto,case,if,while,switch,const,double,enum,float,goto,break,char,continue,do,else,extern,for,int,register,short,signed,sizeof,struct,typedef,unsigned,volatile,long,return,static,switch,union,void.


Answered by Sunil 
student, OCC (Online coaching Class)
 www.onlinecoachingclass.org

2 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Interesting Article. Hoping that you will continue posting an article having a piece of useful information. .science class 12

    ReplyDelete