What is the meaning of saying
fun()=30;
count<<fun();
Function definition is:
int &fun()
{
static int x = 10;
return x;
}
What is the meaning of saying
fun()=30;
count<<fun();
Function definition is:
int &fun()
{
static int x = 10;
return x;
}
int& fun();
The return type of fun() is an integer reference.
fun() = 30
assign the value 30 to the integer referenced by the return value of fun().
Which integer?
int &fun()
{
static int x = 10; // <-- this one
return x;
}