Solution:NIIT/GNIIT Sonugiri0032@gmail.com

Wednesday, January 06, 2016

Local Variables in C++

Local Variables in C++


Structure of the Problem Requirements  

Local variables have some limited access and the are only accessible within the scope of the function or block . Two Separate function could have the same name local variables because they are unknown from outside of the function.

Source Code

#include<iostream>
using namespace std;
int main ()
{
 int num1,num2,num3;                 // declare the variables
 num1 =786, num2 =567;         // initialize the variables 
 num3=num1-num2;
 cout<<" \n Num1 is Local variable with values : "<<num1;
 cout<<" \n Num2 is Local variable with values : "<<num2;
 cout<<" \n \n  The Subtraction of these local variables is : "<<num3;
}

Output of the Program

Local Variables in C++
Share:

0 comments:

GNIITSOLUTION GNIIT SOLUTION. Powered by Blogger.

Translate

Blog Archive

Unordered List