Variables


Variable
DEFINITION:
Variable is a value  or quantity which may  vary during  program execution is called  a Variable.
Each variable has specific memory location in Memory Unit, where Numerical values or characters can be stored.
We can also call a variable as an Identifier i.e., they identify the varying quantities and stores them in particular memory location.
Example:
Sum=a+b;
In the above example there are “a” and “b” two Identifiers/variables representing two separate quantities in two distinct(different) memory locations.
Similarly Sum is also an variable  name which used to store the sum of two numbers i.e.,(addition of a and b).

                                                MEMORY                                                 
variable a
variable b
variable Sum


             
↔↔↔↔↔↔ memory                           locations


Rules for Naming Variables in C
Ø  A variable name must consist of  a single letter or sequence of characters,digits,or underscore(“_")characters.
Ø Examples:  int total; int  _total; and  int total1;
Ø The first character of a variable name must start with letters,or an underscore character.
Ø Examples:  int total;
Ø The variable length must be a maximum of 8 characters.
Ø In C UPPER CASE  and LOWER CASE letters considrred as an differrnt variable.
Ø Examples:  int  AVG; and int avg ; both are treated as an individual variables .
Friends I will come with next topic very  soon thank you plz like and Subscribe my
Topics related to C.



Comments

Popular posts from this blog

Data types in C Programming

Web Programming

Even or Odd Program in C