Here's some example code:
#include <iostream>
using namespace std;
struct number { float x; };
number test_func(void) { static number v; return v; }
int main()
{
const number one = { 1.0f };
test_func() = one;
test_func().x += 1.0f;
cout << test_func().x << endl;
return 0;
} Mini quiz:
1. Without using a compiler look at the code. Would you expect any warnings or errors from the compiler? Why?
2. What would you expect the output to be if it compiled?
3. Now compare your results to what actually happens when you compile it. Is it what you expected?