Function Call by Value in C++

In pass by value or call by value copy of variables are passed to the function to perform specific operation. The actual values of the variables are unchanged and changes are made only to copied values of the variables.

Source Code 

#include<iostream>
using namespace std;
int LEP ( int a , int b)
{
 int c = a+b;
 return c;
}
 int main ()
{
 cout<<" \t \t \t LEP Tutorials \n \n  ";
 int x,y;
 cout<<" Enter Your 1st Number     : ";
 cin>>x;
 cout<<"   Enter Your 2nd Number     : ";
 cin>>y;
 //LEP(x,y);
 int sum = LEP(x,y);
 cout<<"   The Sum of Both Numbers is: "<<sum<<endl;
 }

Output of the Program

Function Call by Value in C++

Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment