Variable in C language


Variable.                     
     
In Programming,A Variable Is A Container (Storage Area) To Hold Data.

A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.

 will be the following basic variable types −

To Indicate The Storage Area,Each Variable Should be Given A Unique Name (Identifier).Variable Names Are Just The Symbolic Representation Of A Memory Location.Variable names are just the symbolic representation of a memory location. For example:

int  StudentMArks=72;

Here [StudentMarks] is a variable of int type.Here the variable assigned an integer value 72.

 

The name of a variable can be composed of letters, digits, and the underscore character. It must begin with either a letter or an underscore. Upper and lowercase letters are distinct because C is case-sensitive. Based on the basic types explained in the previous chapter, there

Rules of naming  Variable  

  •  Variable are case sensitive
  • A variable name can only have letters (both uppercase and lowercase letters), digits and        underscore.
  • The first letter of a variable should be either a letter or an underscore.
  • There is no rule on how long a variable name (identifier) can be. However, you may run into problems in some compilers if the variable name is longer than 31 characters 


The name of a variable can be composed of letters, digits, and the underscore character. It must begin with either a letter or an underscore. Upper and lowercase letters are distinct because C is case-sensitive. Based on the basic types explained in the previous chapter, there will be the following basic variable types −

  1. Integer
  2. Character
  3. float
  4. Double
  5. void
Integer: As the name suggests, an int variable is used to store an integer.
An integer is a numeric literal(associated with number)without any fractional or exponential part these are three type of literal integer in C programme
  • decimal
  • Octal
  • hexadecimal


Character:A charcter literal is created by enclosing a single charchter inside single  
A character literal is created by enclosing a single character inside single quotation marks. For example: 'a', 'm', 'F', '2', '}' etc .

















Comments

Popular posts from this blog

C language introduction

C keyword and identifier