Popular Posts

Saturday, July 19, 2008

CONSTANTS,VARIABLES AND KEYWORDS

CONSTANTS,VARIABLES AND KEYWORDS:

CONSTANTS:

Two types of constants those are:
a)primary constants
b)secondary constants

a)In primary constants they are integer,real,character constants.
b)In secondary constants they are array,pointer,structure,union,enum etc.

VARIABLES:

a variable is a dataname that may be used to store a data value.unlike constants that
remain unchanged during the execution of a program,a variable may take different values at different times during execution.

Rules for constructing variables:

1. they must begin with a letter.some systems permit underscore as the first character.
2.ANSI standard recognizes alenght of 31 characters.however,the lenght should not be normally
more than eight characters,since only the first eight charaters are treated as significant by
many compilers.
3.uppercase and lower case are significant.that is,the variable total is not the same as total or TOTAL.
4.the variable name should not be keyword.
5.white space is not allowed.

example: int a=10;//int is a datatype,a is a variable in which '10' value is stored.

KEYWORDS:

keywords are the words whose meaning has already been explained to the compiler.
this cannot be used as variable names because if we do so we are trying to assign a new meaning to the keyword.
some of the keywords are
auto                            double                 if                      static
break                           else                   int                     struct
case                            enum                 long                   switch
char                           extern               near                  typedef    etc

No comments:

Post a Comment