#include <iostream.h>
int byValue(int x)
{
x=10;
return x;
}
int byReference(int& y)
{
y=12;
return y;
}
int main()
{
int a=8;
cout<<byValue(a)<<endl;
cout<<a<<endl;
cout<<byReference(a)<<endl;
cout<<a<<endl;
return 0;
}
#include <iostream.h>
int byValue(int x)
{
x=10;
return x;
}
int byReference(int& y)
{
y=12;
return y;
}
int main()
{
int a=8;
cout<<byValue(a)<<endl;
cout<<a<<endl;
cout<<byReference(a)<<endl;
cout<<a<<endl;
return 0;
}
0 Response for the "Value and Reference"
Post a Comment