Variable in C Programming Language

Posted on

Variable in C Language

 

Variables is a reminiscence areas.This location is used to retailer the worth of the variable.

Its worth will be modified.we will change worth of a variable throughout execution of a program.

 

There are some guidelines for defing variables

  1. Variables are case delicate
  2. A variable can have Alphabets, underscore(_) and digit.
  3. No particular symbols are allowed aside from underscore.
  4. A variable title can begin with alphabet and underscore solely. It could possibly’t begin with digit.
  5. Clean areas can’t be utilized in variable names.
  6. A variable title should not be any reserved phrase or key phrase e.g. int, float and so forth.


Variable declaration

data_type variable_name; Ex:- int a, b, c; char title, ch;


Variable initialization

data_type variable_name = worth; Ex:- int a = 60, b = 90; char title = �alok�, ch=�l�;


TYPES OF VARIABLE

 

  1. native variable
  2. static variable
  3. world variable
  4. exterior variable
  5. automated variable

Native Variable

native variables shall be contained in the perform solely.

a neighborhood variable is a variable that’s given native scope.

It could possibly�t be accessed outdoors the perform.

Static Variable

a static variable is a variable that has been allotted statically in order that its lifetime or “extent” extends throughout your entire run of this system.

Static variable that’s declared with static key phrase.


World Variable

A worldwide variable is a variable with world scope.

This variable is outlined outdoors the primary perform.

These variables will be accessed from anyplace in this system.

This variable is seen to primary perform and all different sub capabilities.