void by_value ( int a )
{
a = 15 ;
}
void by_reference ( int &a )
{
a = 20 ;
}
void main ( )
{
int x = 10 ;
by_value ( x ) ;
cout << "By Value: " << x << endl ;
by_reference ( x ) ;
cout << "By Reference: " << x << endl ;
}
RAM
Address Value
0x00 GARBAGE
0x01 GARBAGE
0x02 GARBAGE
0x03 GARBAGE
0x04 GARBAGE
0x05 GARBAGE
$
Call Stack
Symbol Table
Name Memory Address