Tuesday 12 February 2013

Declaration of variables in C++ Programming Language



Variable is a quantity which changes during the execution of the program.

All variables present in the program must be declared before it is used. The declaration can also be done before the first use of the variable. The general for is

datatype variablelist;

Example:

1) int a, b, c;
This declares a, b, c as integer variables and allocate memory space.

2) int n;
for(int j=0; j<=n;j++)

This is valid because j is declared as int j before it is used.

0 comments:

Post a Comment

Powered by Blogger.