![]() |
Initializing And Declaration Of Variables in C and C++ |
Declaration
In C++ (as in many other programming languages) all the variables that a program is going to use must be declared prior to use.
for example int i , j. float f, double etc..
Initialization
Process of giving value to a function is known as initializing a variable.
for example int i = 50;
Basic Program
#include<iostream.h>
int main()
{
int i; //declaration of variable
i = 0; // initializing a variable
cout<<"Value of i is "<<i<<endl;
}
output:
value of i is 0
0 comments:
Post a Comment