// Demonstrating pass by reference and pass by value along with static in function // Written by Lee Devlin 1-19-2011 // change printIt argument from pass by reference to pass by value and notice the difference in behavior. // that is, change the function prototype and header to void printIt(int &b); // then change int c in printIt to be a static variable, i.e., "static int c = 200;" and notice the difference. #include using namespace std; void printIt(int b); int main() { int a = 1; cout << "the integer a is " << a << endl; printIt(a); printIt(a); printIt(a); cout << "the integer a is " << a << endl; system ("pause"); } void printIt(int b) { int c = 200; cout << "b is equal to " << b << endl; b++; c++; cout << "c is equal to " << c << endl; }