Ad Code

Responsive Advertisement

veriable and constant.

First we understood why required the veriable and constant :

when the user want to store the value than he required the veruable that stored the value.

There are two type that a value can be storeds 
1) veriable.
2) Constant.

In this two method the user can stored the value

1) veriable : to store the value or data we need one name,which is called veriable.
A veriable declaraction tells compiler that what veriable names is and also specified which type of data values is stored.

Veriable are stored in memory location used by a program to stored data.
A veriable name is identifier chosen by programmer. Veriable name should be meaningful which should reflect in program.
Veriable name consists of letters , underscore(_) and digit.

Following are the rules for naming the veriable.


1. veriable should be start with letter or underscore(_).
2. Lenth should not be normally exceed than eight character.
3. It should not be keyword.
4. All veriable must be declared before they can appear in executable statement.
5. A declaraction consists of a data type followed by one or more veriable names separated by commas.

Example : int a,b,c;6
6.veriable can be distributed among declaraction in any fashion.
The above declaraction  can be written as

  int a;
int b,c;

2) constant : a constant is same as a veriable rule but , in constant the value cannot be changed when it declara, if the user declare the constant value than it cannot ne changed durring the program execution .

Syntac : datatype const veriable value;

like : int const a=10;

here a value is 10 but the user cannot changed the value of a. Because it is constant.

Post a Comment

0 Comments