Search This Blog

Tuesday, 9 April 2013

variable

Variable is a name of memory location which is used to store constant values.
 Or
Variable is a name given to memory cells (location) of a computer where constant value is stored. Unlike constant variable values may change during the program execution.( It is opposite to constant).
Syntax
<data_type><variable_name>=Constant value;
                 EX: int a=5;
                     or
<data type><variable name>;
Ex:int  a;
Rules for variables:
·         First character should be letter or alphabet.
·         Keywords are not allowed to use as a variable name.
·         White space is not allowed.
·         C is case sensitive i.e. UPPER and lower case are significant.
·         Only underscore, special symbol is allowed between two characters.
·         The length of identifier may be up to 31 characters but only only the first 8 characters are significant by compiler.
·         (Note: Some compilers allow variable names whose length may be up to 247 characters. But, it is recommended to use maximum 31 characters in variable name. Large variable name leads to occur errors.)
Identifier :
    Identifier is the name of a variable that is made up from combination of alphabets, digits and underscore.


0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Hostgator Discount Code