// program to illustrate call by value as well as call by reference
#include<iostream>
#include<conio.h>
void passbyvalue(int x);
void passbyreference(int *x);
void main()
{
int a=13;
int b=13;
passbyvalue(a); /// call by value
passbyreference(&b); call by address
cout<<a<<endl;
cout<<b<<endl;
getch();
}
void passbyvalue(int x)
{
x=33;
}
void passbyreference(int *x)
{
*x=99;
}
Output
No comments:
Post a Comment