Sunday, July 17, 2011

Variables in C & C++

Variables:-
                  A variable is a space in the computer memory that is set aside for a certain kind of data and given a name for easy reference.A variable is one whose value can be change in the program, a variable can be assign a fix value or can also be a formula.  
e.g  num = 18; or
      num = a*b ;
Following are the types of variables we used in C and C++ programming  languages.
Integer two bytes 
Float four bytes
Char 1 byte
String depends on numbers of characters

Variable Conventions:-
  1. Variable name is any combination of 1 to 31 alphabets, digits, or "_".
  2. The first character in the variable name must be an alphabet or "_".
  3. No coma or blanks are allowed within the variable name.
  4. No special symbol other than the "_" can be used in a variable name.
  5. A variable name must be a meaningful name according to specific program.

No comments:

Post a Comment