Friday 6 February 2015

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 it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

0 comments:

Post a Comment