Using a function that returns a referenced value

a has been set to 10; b is referencing a function which calls a as a global variable, then doubles the value and returns it.

a: 20
b: 20

Changing the value of the referece

b has been set to 30.


a: 30
b: 30

Using a static variable in a reference

A function has been created which uses a static varaible, increments it, and then returns it.

The result is after another variable has been set to reference the function, the function has been called, the variable has been incremented, and the function called again.

c: 4