#include<iostream.h>
#include<conio.h>
int sum(int x,int y); // Function Delaration
main()
{
clrscr();
int a,b,c;
cout<<"Enter First NUmber=";
cin>>a;
cout<<"Enter Second NUmber=";
cin>>b;
c=sum(a,b); // Function CAlling
cout<<"\n NAswer="<<c;
getch();
}
int sum(int x,int y) // Function Define
{
int z;
z=x+y;
return z;
}
----------------------------------------------------------------------------
Passing a variable by value makes a copy of the
variable before passing it onto a function. This means
that if you try to modify the value inside a function, it
will only have the modified value inside that
function. One the function returns, the variable you
passed it will have the same value it had before you
passed it into the function.
No comments:
Post a Comment