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 may be modified.we are able to 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 actually’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 on.


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. international 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 actually�t be accessed exterior 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 complete run of this system.

Static variable that’s declared with static key phrase.


International Variable

A worldwide variable is a variable with international scope.

This variable is outlined exterior the primary perform.

These variables may be accessed from anyplace in this system.

This variable is seen to essential perform and all different sub features.