Value and Reference

Posted by Didi Setyapramana On 4:04 AM 0 komentar

#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;
}

Categories:

0 Response for the "Value and Reference"

Post a Comment