1/24/00
COM1100 Winter2000 Lecture 7
20
Method 2 -- Example
n
void
Increment(int
&
n);
// function declaration
n
void
Increment(int
&
n){
// function definition
n
n = n+1;
n
};
n
int main() {
n
int x = 25;
n
cout << x << " ~~~ ";
n
Increment(x);
n
cout << x << endl;
n
return 0;
n
}
n
// this will print
25 ~~~ 26
n
n