/*
CS371p: Quiz #8 (5 pts)
*/

/* -----------------------------------------------------------------------
1. What is the output of the following program?
   (4 pts)

3 5
3 3 3
*/

#include <iostream> // cout, endl

using namespace std;

void f (int* p, int& r) {
    ++*p;
    ++r;
    p = &r;
    ++*p;}

int& g () {
    static int v = 2;
    return v;}

int main () {
    {
    int i = 2;
    int j = 3;
    f(&i, j);
    cout << i << " ";
    cout << j << endl;
    }

    {
    int  i = g();
    ++i;
    int& r = g();
    ++r;
    int  j = g();
    cout << i << " ";
    cout << r << " ";
    cout << j << endl;
    }

    return 0;}


syntax highlighted by Code2HTML, v. 0.9.1