CS 131 Function Exercises (answers) Identify for each of the following: local and global variables value and reference parameters the output //*********Example 1********* #include using namespace std; void change(); int main () { int x; //local x = 0; change(); cout << x; return 0; } void change() { x = 1; } OUTPUT: error when compiling, 'x' : undeclared identifier //*********Example 2********* #include using namespace std; void change(); int x; //global int main () { x = 0; change(); cout << x; return 0; } void change() { x = 1; } OUTPUT: 1 //*********Example 3********* #include using namespace std; void change(); int x; //global int main () { x = 0; change(); cout << x; return 0; } void change() { int x; x = 1; } OUTPUT: 0 //*********Example 4********* #include using namespace std; void change(int); int main () { int x; //local x = 0; change(x); //argument x cout << x; return 0; } void change(int y) //value parameter y { y = 1; } OUTPUT: 0 //*********Example 5********* #include void change(int&); int main () { int x; //local x = 0; change(x); //argument x cout << x; return 0; } void change(int& y) //reference parameter y { y = 1; } OUTPUT: 1