Monday

Variables in C++

About variables :-
                                 In C++ programming language a variable is something which provides a storage which can also be changed as it is clear by it's name that a variable is something whose value can be varied.



 In C++ a variable is very important because a lot of programs consist on it.
                                                                                                                            The program in which the sum is stored in third value also consists on it and except for it there are a lot of more also. A simple program is given below:
                                                   
 
There are also some rules of assigning name to a variable and everyone should work upon those rules.

Rules of assigning names :-
                                                  The rules upon which an should be kept during when we assign names to any variable are given  below:

1) The name must include alphabets, numbers or underscore only like;
         int all_1;  is correct way of assigning name.

2)
Special characters (!,@,#,$,%,^, &,*,<,>,?) must not be the part of a variable's name like
         int all@1;   is wrong way of assigning name to a variable.

3) The name must be start by alphabets or by underscore. Other wise an error will be given.
         int all_1; or int _all1;
are correct  ways.    

4) The name should not start by numbers like;
         int 1_all; is also wrong way.

5)
There must not be any whitespace between the characters(alphabets, numbers or underscore) upon which the name of the variable consists like;
         int all 1; is also wrong way.


                              For source code click on :  http://pastebin.com/uDqGSwf8

No comments:

Post a Comment