Variable of c++


             Variable                 

Defination:-
                      It is a name of storage space which is use to store data. Its value is changeable. It's always value contain last value stored to it. It is always declared with data type.


Variable of c++

                Variable declaration
int no;                                                                 
float percentage;                                              
char grade;                                                        
here, no is a variable of type int, Percentage is a variable of type float, and grade is a variable of type char.

              Variable initialization
int no=5;                                                           
float Percentage=67.9;                                   
char grade ='A';                                                
here,5 is the value of int, 67.9 is the value of Percentage, A is the value of grade. Character value is always writine  in single qoutes.     
     
       Rule to declared a variable
  1. The first letter is a variable should be alphabet or underscore (_).
  2. The first letter is a variable should not be digit.
  3. After first character it may be combination of alphabet and digit.
  4. Blank space are not allowed in variable name.
  5. Variable name should not be keywords.

Comments

Post a Comment

If you have any doubt. Please comment me know.

Popular posts from this blog

Function in C++ with example & declaration, initialization function in c++

Operators of c++

Storage class in c++