Showing posts with label Function Call by Value in C. Show all posts
Showing posts with label Function Call by Value in C. Show all posts

Tuesday, 3 February 2015

Function Call by Value in C++

Structure of the Problem Requirements

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++