home *** CD-ROM | disk | FTP | other *** search
- // \EXAMPLES\EX0412.CPP
- #include <iostream.h>
-
- void f(int* i) {
- *i = 3; // change the value of what i points to
- }
-
- void g(int& j) {
- j = 4; // change the value of the reference
- }
-
- void main() {
- int i = 0, j = 0;
- f(&i); // pass a pointer to i to f()
- cout << "Here is i after the call to f(): " << i << endl;
- g(j); // pass j to g()
- cout << "Here is j after the call to g(): " << j << endl;
- }
-